]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
format-c.c: Prepare for sharing code with libintlext.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Nov 2010 13:46:10 +0000 (14:46 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 7 Jun 2011 21:38:48 +0000 (23:38 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/format-c.c

index 87202d3f50b0658431a36187b88eff102e05e60d..f3a767d43ba054a0dd7e8fdecada3dd55b234618 100644 (file)
@@ -1,3 +1,10 @@
+2010-11-07  Bruno Haible  <bruno@clisp.org>
+
+       format-c.c: Prepare for sharing code with libintlext.
+       * format-c.c (INVALID_ANGLE_BRACKET, INVALID_IGNORED_ARGUMENT): New
+       macros.
+       (format_parse): Use them.
+
 2011-06-07  Bruno Haible  <bruno@clisp.org>
 
        Rely more on libtool.
index 929e835c03d3b6eb1cfbdaaacaacbf1f118f4a84..a9cf5c6963fa998b04ee869572fd505795c0e437 100644 (file)
@@ -180,6 +180,12 @@ numbered_arg_compare (const void *p1, const void *p2)
 #define INVALID_C99_MACRO(directive_number) \
   xasprintf (_("In the directive number %u, the token after '<' is not the name of a format specifier macro. The valid macro names are listed in ISO C 99 section 7.8.1."), directive_number)
 
+#define INVALID_ANGLE_BRACKET(directive_number) \
+  xasprintf (_("In the directive number %u, the token after '<' is not followed by '>'."), directive_number)
+
+#define INVALID_IGNORED_ARGUMENT(referenced_arg, ignored_arg) \
+  xasprintf (_("The string refers to argument number %u but ignores argument number %u."), referenced_arg, ignored_arg)
+
 static void *
 format_parse (const char *format, bool translated, bool objc_extensions,
               char *fdi, char **invalid_reason)
@@ -584,8 +590,7 @@ format_parse (const char *format, bool translated, bool objc_extensions,
 
             if (*format != '>')
               {
-                *invalid_reason =
-                  xasprintf (_("In the directive number %u, the token after '<' is not followed by '>'."), spec.directives);
+                *invalid_reason = INVALID_ANGLE_BRACKET (spec.directives);
                 FDI_SET (*format == '\0' ? format - 1 : format, FMTDIR_ERROR);
                 goto bad_format;
               }
@@ -810,8 +815,7 @@ format_parse (const char *format, bool translated, bool objc_extensions,
       for (i = 0; i < numbered_arg_count; i++)
         if (numbered[i].number != i + 1)
           {
-            *invalid_reason =
-              xasprintf (_("The string refers to argument number %u but ignores argument number %u."), numbered[i].number, i + 1);
+            *invalid_reason = INVALID_IGNORED_ARGUMENT (numbered[i].number, i + 1);
             goto bad_format;
           }