[PATCH 4/8] gettext: #ifdef away GETTEXT POISON-related code from _() and Q_()
From: SZEDER Gábor <hidden>
Date: 2018-10-22 20:23:35
Subsystem:
the rest · Maintainer:
Linus Torvalds
The gettext wrapper functions _() and Q_() contain a GETTEXT POISON-related conditional construct even in non-GETTEXT POISON builds, though both of those conditions are #define-d to be false already at compile time. Both constructs will grow in a later patch, using a GETTEXT POISON-specific enum type and calling another GETTEXT POISON-specific function. Prepare for those future changes and hide the GETTEXT POISON-related parts of those functions behind an #ifdef. Signed-off-by: SZEDER Gábor <redacted> --- gettext.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/gettext.h b/gettext.h
index 7eee64a34f..c658942f7d 100644
--- a/gettext.h
+++ b/gettext.h@@ -43,22 +43,26 @@ static inline int gettext_width(const char *s) #ifdef GETTEXT_POISON extern int use_gettext_poison(void); -#else -#define use_gettext_poison() 0 #endif static inline FORMAT_PRESERVING(1) const char *_(const char *msgid) { if (!*msgid) return ""; - return use_gettext_poison() ? "# GETTEXT POISON #" : gettext(msgid); +#ifdef GETTEXT_POISON + if (use_gettext_poison()) + return "# GETTEXT POISON #"; +#endif + return gettext(msgid); } static inline FORMAT_PRESERVING(1) FORMAT_PRESERVING(2) const char *Q_(const char *msgid, const char *plu, unsigned long n) { +#ifdef GETTEXT_POISON if (use_gettext_poison()) return "# GETTEXT POISON #"; +#endif return ngettext(msgid, plu, n); }
--
2.19.1.681.g6bd79da3f5