Make event_block_t.event not a reference

Stylistic tweaks
This commit is contained in:
ridiculousfish 2012-12-22 12:40:34 -08:00
parent e31431140a
commit 37bdb20092
5 changed files with 10 additions and 18 deletions

View file

@ -1014,7 +1014,7 @@ static int builtin_emit(parser_t &parser, wchar_t **argv)
append_format(stderr_buffer, L"%ls: expected event name\n", argv[0]);
return STATUS_BUILTIN_ERROR;
}
wchar_t *eventname = argv[woptind];
const wchar_t *eventname = argv[woptind];
wcstring_list_t args(argv + woptind + 1, argv + argc);
event_fire_generic(eventname, &args);

View file

@ -330,8 +330,6 @@ void event_add_handler(const event_t &event)
void event_remove(const event_t &criterion)
{
size_t i;
event_list_t new_list;
if (debug_level >= 3)
@ -352,7 +350,7 @@ void event_remove(const event_t &criterion)
if (events.empty())
return;
for (i=0; i<events.size(); i++)
for (size_t i=0; i<events.size(); i++)
{
event_t *n = events.at(i);
if (event_match(criterion, *n))
@ -452,7 +450,6 @@ static int event_is_killed(const event_t &e)
static void event_fire_internal(const event_t &event)
{
size_t i, j;
event_list_t fire;
/*
@ -472,7 +469,7 @@ static void event_fire_internal(const event_t &event)
event_add_handler, which will change the contents of the \c
events list.
*/
for (i=0; i<events.size(); i++)
for (size_t i=0; i<events.size(); i++)
{
event_t *criterion = events.at(i);
@ -495,7 +492,7 @@ static void event_fire_internal(const event_t &event)
Iterate over our list of matching events
*/
for (i=0; i<fire.size(); i++)
for (size_t i=0; i<fire.size(); i++)
{
event_t *criterion = fire.at(i);
int prev_status;
@ -511,15 +508,12 @@ static void event_fire_internal(const event_t &event)
*/
wcstring buffer = criterion->function_name;
if (! event.arguments.empty())
{
for (j=0; j < event.arguments.size(); j++)
for (size_t j=0; j < event.arguments.size(); j++)
{
wcstring arg_esc = escape_string(event.arguments.at(j), 1);
buffer += L" ";
buffer += arg_esc;
}
}
// debug( 1, L"Event handler fires command '%ls'", buffer.c_str() );

View file

@ -89,8 +89,6 @@ struct event_t
event_t(int t) : type(t), param1(), str_param1(), function_name(), arguments() { }
/** default copy constructor */
//event_t(const event_t &x);
static event_t signal_event(int sig);
static event_t variable_event(const wcstring &str);

View file

@ -2077,7 +2077,6 @@ int parser_t::parse_job(process_t *p,
int tmp;
const wchar_t *cmd = args.at(0).completion.c_str();
wcstring_list_t event_args;
/*
We couldn't find the specified command.
@ -2159,6 +2158,7 @@ int parser_t::parse_job(process_t *p,
job_set_flag(j, JOB_SKIP, 1);
wcstring_list_t event_args;
event_args.push_back(args.at(0).completion);
event_fire_generic(L"fish_command_not_found", &event_args);
proc_set_last_status(err==ENOENT?STATUS_UNKNOWN_COMMAND:STATUS_NOT_EXECUTABLE);

View file

@ -158,7 +158,7 @@ struct if_block_t : public block_t
struct event_block_t : public block_t
{
event_t const &event;
event_t const event;
event_block_t(const event_t &evt);
};