mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
event: Pass name as wcstring
This passed a wchar_t, only to then construct a wcstring out of it. Instead let's just pass it directly and move it.
This commit is contained in:
parent
ac888ac6af
commit
f98398b418
|
@ -492,11 +492,9 @@ void event_print(io_streams_t &streams, const wcstring &type_filter) {
|
|||
}
|
||||
}
|
||||
|
||||
void event_fire_generic(parser_t &parser, const wchar_t *name, const wcstring_list_t *args) {
|
||||
assert(name && "Null name");
|
||||
|
||||
void event_fire_generic(parser_t &parser, wcstring name, const wcstring_list_t *args) {
|
||||
event_t ev(event_type_t::generic);
|
||||
ev.desc.str_param1 = name;
|
||||
ev.desc.str_param1 = std::move(name);
|
||||
if (args) ev.arguments = *args;
|
||||
event_fire(parser, ev);
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ void event_print(io_streams_t &streams, const wcstring &type_filter);
|
|||
wcstring event_get_desc(const parser_t &parser, const event_t &e);
|
||||
|
||||
/// Fire a generic event with the specified name.
|
||||
void event_fire_generic(parser_t &parser, const wchar_t *name,
|
||||
void event_fire_generic(parser_t &parser, wcstring name,
|
||||
const wcstring_list_t *args = nullptr);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4011,7 +4011,7 @@ maybe_t<wcstring> reader_data_t::readline(int nchars_or_0) {
|
|||
first_prompt = false;
|
||||
|
||||
if (!conf.event.empty()) {
|
||||
event_fire_generic(parser(), conf.event.c_str());
|
||||
event_fire_generic(parser(), conf.event);
|
||||
}
|
||||
exec_prompt();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user