diff mbox series

[5/8] gettext: put "# GETTEXT POISON #" string literal into a macro

Message ID 20181022202241.18629-6-szeder.dev@gmail.com (mailing list archive)
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 POISON #" string literal is currently used in two
functions in 'gettext.h'.  A later patch will add a function to
'gettext.c' using this string literal as well.

Avoid this duplication and put that string literal into a macro which
is only available in GETTEXT POISON builds.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 gettext.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gettext.h b/gettext.h
index c658942f7d..8e279622f6 100644
--- a/gettext.h
+++ b/gettext.h
@@ -43,6 +43,8 @@  static inline int gettext_width(const char *s)
 
 #ifdef GETTEXT_POISON
 extern int use_gettext_poison(void);
+
+#define GETTEXT_POISON_MAGIC "# GETTEXT POISON #"
 #endif
 
 static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
@@ -51,7 +53,7 @@  static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
 		return "";
 #ifdef GETTEXT_POISON
 	if (use_gettext_poison())
-		return "# GETTEXT POISON #";
+		return GETTEXT_POISON_MAGIC;
 #endif
 	return gettext(msgid);
 }
@@ -61,7 +63,7 @@  const char *Q_(const char *msgid, const char *plu, unsigned long n)
 {
 #ifdef GETTEXT_POISON
 	if (use_gettext_poison())
-		return "# GETTEXT POISON #";
+		return GETTEXT_POISON_MAGIC;
 #endif
 	return ngettext(msgid, plu, n);
 }