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

Patch

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);
 }