]> Savannah Git Hosting - gnulib.git/commitdiff
argmatch: don't define _ in the header
authorAkim Demaille <akim.demaille@gmail.com>
Wed, 3 Jul 2019 04:35:34 +0000 (06:35 +0200)
committerAkim Demaille <akim.demaille@gmail.com>
Wed, 3 Jul 2019 04:45:16 +0000 (06:45 +0200)
Reported by Jim Meyering.

* lib/argmatch.h (N_, _): Don't define.
Use gettext instead.
* lib/argmatch.h (_): Define.
* tests/test-argmatch.c (N_): Define.

ChangeLog
lib/argmatch.c
lib/argmatch.h
tests/test-argmatch.c

index b89fd5d9e5e9ddd667a4b9590533e768eebaff10..c3e1978709e85708361309e6c6a37a219a99dd4a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-07-03  Akim Demaille  <akim@lrde.epita.fr>
+
+       argmatch: don't define _ in the header.
+       Reported by Jim Meyering.
+       * lib/argmatch.h (N_, _): Don't define.
+       Use gettext instead.
+       * lib/argmatch.h (_): Define.
+       * tests/test-argmatch.c (N_): Define.
+
 2019-07-02  Paul Eggert  <eggert@cs.ucla.edu>
 
        verify: document ‘assume’ better
index 183a0ca941c74874cdebb6fb913f300a1c186e67..9eeb4514d8c715e229b5665b958bbdc2a668d224 100644 (file)
@@ -29,6 +29,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#define _(msgid) gettext (msgid)
+
 #include "error.h"
 #include "quotearg.h"
 #include "getprogname.h"
index d185499423c58b9239df16ced7be76591873e324..57d131f32d129614b480e9724dd95a282d73c8fb 100644 (file)
@@ -32,9 +32,6 @@
 # include "quote.h"
 # include "verify.h"
 
-# define _(Msgid)  gettext (Msgid)
-# define N_(Msgid) (Msgid)
-
 # ifdef  __cplusplus
 extern "C" {
 # endif
@@ -223,7 +220,7 @@ char const *argmatch_to_argument (void const *value,
                                                                         \
     /* Try to put synonyms on the same line.  Synonyms are expected     \
        to follow each other. */                                         \
-    fputs (_("Valid arguments are:"), out);                             \
+    fputs (gettext ("Valid arguments are:"), out);                      \
     for (int i = 0; g->args[i].arg; i++)                                \
       if (i == 0                                                        \
           || memcmp (&g->args[i-1].val, &g->args[i].val, size))         \
@@ -284,7 +281,7 @@ char const *argmatch_to_argument (void const *value,
        large width. */                                                  \
     const int screen_width = getenv ("HELP2MAN") ? INT_MAX : 80;        \
     if (g->doc_pre)                                                     \
-      fprintf (out, "%s\n", _(g->doc_pre));                             \
+      fprintf (out, "%s\n", gettext (g->doc_pre));                      \
     int doc_col = argmatch_##Name##_doc_col ();                         \
     for (int i = 0; g->docs[i].arg; ++i)                                \
       {                                                                 \
@@ -321,10 +318,11 @@ char const *argmatch_to_argument (void const *value,
             fprintf (out, "\n");                                        \
             col = 0;                                                    \
           }                                                             \
-        fprintf (out, "%*s%s\n", doc_col - col, "", _(g->docs[i].doc)); \
+        fprintf (out, "%*s%s\n",                                        \
+                 doc_col - col, "", gettext (g->docs[i].doc));          \
       }                                                                 \
     if (g->doc_post)                                                    \
-      fprintf (out, "%s\n", _(g->doc_post));                            \
+      fprintf (out, "%s\n", gettext (g->doc_post));                     \
   }
 
 # ifdef  __cplusplus
index 11b5819eaf5b64c66a10f268f4d8caecd0b59e3e..7b1b38a1945a1c7f6542012c345cf20a8ddbd8eb 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "macros.h"
 
+# define N_(Msgid) (Msgid)
+
 /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
    thus must link with a definition of that function.  Provide it here.  */
 #ifdef ARGMATCH_DIE_DECL