Quoth Jani Nikula on Dec 04 at 2:35 pm: > > > +int > > > +notmuch_run_hook (const char *db_path, const char *hook) > > > +{ > > > + char *hook_path; > > > + int status = 0; > > > > You use status as both a notmuch_status_t and for generic C library > > results. This seems a little weird. You may or may not want to do > > anything about it. > > True, it's not consistent. I'll want to do something about it. I wonder > if it's worth returning anything other than ok/fail from this function > anyway. > > There seems to be some confusion in notmuch_status_t usage across > notmuch cli. Should notmuch cli return a notmuch_status_t as exit > status? It currently does at least in some cases, but it also returns > plain 1 too which is (unintentionally) NOTMUCH_STATUS_OUT_OF_MEMORY. > > Does it make sense for the cli to use the lib statuses internally > anyway; you wouldn't want to add new status codes to the lib just to be > able to use them in cli.
I think the answer is that there's no good answer because error handling in C is so lame. In this particular case, I'd say there's little point in distinguishing different errors (and especially no point in returning not-quite-appropriate status codes), so perhaps it should follow the 0/1 convention. _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch