diff mbox series

[4/8] gettext: #ifdef away GETTEXT POISON-related code from _() and Q_()

Message ID 20181022202241.18629-5-szeder.dev@gmail.com
State New, archived
Headers show
Series [1/8] test-lib.sh: preserve GIT_GETTEXT_POISON from the environment | expand

Commit Message

SZEDER Gábor Oct. 22, 2018, 8:22 p.m. UTC
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 <szeder.dev@gmail.com>
 gettext.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff mbox series


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)
 extern int use_gettext_poison(void);
-#define use_gettext_poison() 0
 static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
 	if (!*msgid)
 		return "";
-	return use_gettext_poison() ? "# GETTEXT POISON #" : gettext(msgid);
+	if (use_gettext_poison())
+		return "# GETTEXT POISON #";
+	return gettext(msgid);
 const char *Q_(const char *msgid, const char *plu, unsigned long n)
 	if (use_gettext_poison())
 		return "# GETTEXT POISON #";
 	return ngettext(msgid, plu, n);