From: Tobias Stoeckmann Date: Fri, 3 Apr 2026 09:08:36 +0000 (+0200) Subject: debug: Link __UL_DBG_ macros together X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24c475b71bfe74e372f11cf4aa65ca0228b1f110;p=thirdparty%2Futil-linux.git debug: Link __UL_DBG_ macros together __UL_DBG_CALL can be used by __UL_DBG_OBJ which can be used by __UL_DBG, which puts the flag check into a single line without duplications. Signed-off-by: Tobias Stoeckmann --- diff --git a/include/debug.h b/include/debug.h index 6f86224c2..3e3e76ed2 100644 --- a/include/debug.h +++ b/include/debug.h @@ -71,24 +71,22 @@ struct ul_debug_maskname { #define __UL_DEBUG_FL_NOADDR (1 << 24) /* Don't print object address */ -#define __UL_DBG_OBJ(lib, pref, flag, h, x) \ +#define __UL_DBG_CALL(lib, pref, flag, x) \ do { \ if ((pref ## flag) & UL_DEBUG_MASK(lib)) { \ - ul_debug_prefix(# lib, # flag, h, UL_DEBUG_MASK(lib)); \ x; \ } \ } while (0) +#define __UL_DBG_OBJ(lib, pref, flag, h, x) \ + __UL_DBG_CALL(lib, pref, flag, { \ + ul_debug_prefix(# lib, # flag, h, UL_DEBUG_MASK(lib)); \ + x; \ + }) + #define __UL_DBG(lib, pref, flag, x) \ __UL_DBG_OBJ(lib, pref, flag, NULL, x) -#define __UL_DBG_CALL(lib, pref, flag, x) \ - do { \ - if ((pref ## flag) & UL_DEBUG_MASK(lib)) { \ - x; \ - } \ - } while (0) - #define __UL_DBG_FLUSH(lib, pref) \ do { \ if (UL_DEBUG_MASK(lib) && UL_DEBUG_MASK(lib) != pref ## INIT) { \