[SSSD] DEBUG macro refactoring v3

Nikolai Kondrashov Nikolai.Kondrashov at redhat.com
Fri Dec 20 20:03:47 UTC 2013


On 12/20/2013 09:43 PM, Stephen Gallagher wrote:
> Actually, minor Nack on 0008:
>
>   #define DEBUG(level, format, ...) do { \
> - -    int __debug_macro_newlevel = debug_get_level(level); \
> - -    if (DEBUG_IS_SET(__debug_macro_newlevel)) \
> - -        debug_fn(__FUNCTION__, __debug_macro_newlevel, format,
> ##__VA_ARGS__); \
> +    int __debug_macro_level = level; \
> +    if (DEBUG_IS_SET(__debug_macro_level)) \
> +        debug_fn(__FUNCTION__, __debug_macro_level, format,
> ##__VA_ARGS__); \
>   } while (0)
>
>
> If you're going to drop debug_get_level(), there's no reason to use
> _debug_macro_level at all here. Drop that too.

Initially I removed it, but then reverted. If removed, it will be possible for
"level" to get evaluated thrice (twice in DEBUG_IS_SET), which might be
undesirable.

Sincerely,
Nick



More information about the sssd-devel mailing list