On Wednesday 18 of July 2012 13:42:15 Nikola Pajkovsky wrote: > Jakub Filak <[email protected]> writes: > > Signed-off-by: Jakub Filak <[email protected]> > > --- > > > > src/lib/run_event.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/src/lib/run_event.c b/src/lib/run_event.c > > index 151b8be..2f9ec92 100644 > > --- a/src/lib/run_event.c > > +++ b/src/lib/run_event.c > > @@ -439,6 +439,11 @@ int run_event_on_dir_name(struct run_event_state > > *state,> > > const char *dump_dir_name, > > const char *event > > > > ) { > > > > + static const size_t alert_prefix_len = sizeof(REPORT_PREFIX_ALERT) - > > 1; + static const size_t ask_prefix_len = sizeof(REPORT_PREFIX_ASK) - > > 1; + static const size_t ask_yes_no_prefix_len = > > sizeof(REPORT_PREFIX_ASK_YES_NO) - 1; + static const size_t > > ask_password_prefix_len = sizeof(REPORT_PREFIX_ASK_PASSWORD) - 1; + > > > > prepare_commands(state, dump_dir_name, event); > > > > /* Execute every command in shell */ > > > > @@ -453,11 +458,6 @@ int run_event_on_dir_name(struct run_event_state > > *state,> > > char *buf; > > char *msg; > > > > - int alert_prefix_len = strlen(REPORT_PREFIX_ALERT); > > - int ask_prefix_len = strlen(REPORT_PREFIX_ASK); > > - int ask_yes_no_prefix_len = strlen(REPORT_PREFIX_ASK_YES_NO); > > - int ask_password_prefix_len = strlen(REPORT_PREFIX_ASK_PASSWORD); > > - > > > > while ((buf = xmalloc_fgetline(fp)) != NULL) > > { > > > > msg = buf; > > I still don't get it, why are you/we using strncmp(var, "foo", > sizeof("foo") - 1) for prefix looking. there is way faster function > called _prefixcmp()_
You are right, the prefixcmp() fn is good. I always try to minimalize number of changed lines in working code and I didn't know that prefixcmp() exists ;) I'll change it. But this change will break all of the remaining patches. Therefore I will not change it immediately but I'd rather wait for review comments of all patches. Nikola, are you going to review the remaining patches? Regards Jakub
