Thread (23 messages) flat view 23 messages, 4 authors, 2018-10-24
STALE2849d

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

From: SZEDER Gábor <hidden>
Date: 2018-10-22 20:23:37
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 gettext.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
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);
 }
-- 
2.19.1.681.g6bd79da3f5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help