[pacman-dev] [PATCH] hooks: warn if reassignment overwrites previous setting

git at stefan-klinger.de git at stefan-klinger.de
Tue Jan 3 15:50:17 UTC 2017


On 2017-Jan-03, Eli Schwartz wrote with possible deletions:
> On 01/02/2017 10:19 AM, Stefan Klinger wrote:
> > +        warning(_("hook %s line %d: overwriting previous definition of Type\n"), file, line);
> > +        warning(_("hook %s line %d: overwriting previous definition of When\n"), file, line);
> > +        warning(_("hook %s line %d: overwriting previous definition of Description\n"), file, line);
> > +        warning(_("hook %s line %d: overwriting previous definition of Exec\n"), file, line);
> 
> Look at all the times error is used. ;) You should be formatting the
> warning with the definition type as well.

Yeah, I had that before but was unsure whether it's appreciated to do
formatting with a constant value at runtime.  But I'll change that.


Also, I'd like to change

    #define error(...) _alpm_log(handle, ALPM_LOG_ERROR, __VA_ARGS__); return 1;

to 

    #define error(...) do { _alpm_log(handle, ALPM_LOG_ERROR, __VA_ARGS__); return 1; } while (0)

see [1].  Also move `error` and `warning` both to the top and use
`error` everywhere where appropriate.

____________________
[1] http://stackoverflow.com/questions/257418/do-while-0-what-is-it-good-for#answer-257425



-- 
http://stefan-klinger.de                                      o/X
Send plain text messages only, not exceeding 32kB.            /\/
                                                                \


More information about the pacman-dev mailing list