]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: Delay calls to from_current_source_encoding, part 2.
authorBruno Haible <bruno@clisp.org>
Sun, 4 Nov 2018 22:28:58 +0000 (23:28 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Nov 2018 23:25:34 +0000 (00:25 +0100)
* gettext-tools/src/xg-arglist-parser.h: Include xg-mixed-string.h.
(struct partial_call): Change type of fields msgctxt, msgid, msgid_plural to
'mixed_string_ty *'.
(arglist_parser_remember, arglist_parser_remember_msgctxt): Take a
'mixed_string_ty *' argument instead of a 'char *' argument.
* gettext-tools/src/xg-arglist-parser.c (arglist_parser_clone): Update
accordingly.
(arglist_parser_remember, arglist_parser_remember_msgctxt): Take a
'mixed_string_ty *' argument.
(arglist_parser_done): Convert the mixed_string to UTF-8 encoded 'char *' here.
This is where from_current_source_encoding gets invoked now: immediately before
invoking remember_a_message, that is, only when we really need to know the
--from-source encoding.
* gettext-tools/src/x-c.c (extract_parenthesized): Pass the mixed_string to
arglist_parser_remember. Don't set xgettext_current_source_encoding around
arglist_parser_done calls.
* gettext-tools/src/x-csharp.c (extract_parenthesized): Likewise.
* gettext-tools/src/x-java.c (extract_parenthesized): Likewise.
* gettext-tools/src/x-javascript.c (extract_balanced): Likewise.
* gettext-tools/src/x-python.c (extract_balanced): Likewise.
* gettext-tools/src/x-vala.c (extract_balanced): Likewise.
* gettext-tools/src/x-lisp.c: Include xg-mixed-string.h.
(read_object): Convert the string to a mixed_string_ty before passing it to
arglist_parser_remember.
* gettext-tools/src/x-elisp.c: Likewise.
* gettext-tools/src/x-librep.c: Likewise.
* gettext-tools/src/x-scheme.c: Likewise.
* gettext-tools/src/x-awk.c: Include xg-mixed-string.h.
(extract_parenthesized): Convert the string to a mixed_string_ty before passing
it to arglist_parser_remember.
* gettext-tools/src/x-lua.c: Include xg-mixed-string.h.
(extract_balanced): Convert the string to a mixed_string_ty before passing it to
arglist_parser_remember.
* gettext-tools/src/x-php.c: Include xg-mixed-string.h.
(extract_balanced): Convert the string to a mixed_string_ty before passing it to
arglist_parser_remember.
* gettext-tools/src/x-sh.c: Include xg-mixed-string.h.
(read_command): Convert the string to a mixed_string_ty before passing it to
arglist_parser_remember.
* gettext-tools/src/x-tcl.c: Include xg-mixed-string.h.
(read_command): Convert the string to a mixed_string_ty before passing it to
arglist_parser_remember.
* gettext-tools/src/x-perl.c (extract_balanced): Convert the string to a
mixed_string_ty before passing it to arglist_parser_remember. Don't set
xgettext_current_source_encoding around arglist_parser_done calls.

18 files changed:
gettext-tools/src/x-awk.c
gettext-tools/src/x-c.c
gettext-tools/src/x-csharp.c
gettext-tools/src/x-elisp.c
gettext-tools/src/x-java.c
gettext-tools/src/x-javascript.c
gettext-tools/src/x-librep.c
gettext-tools/src/x-lisp.c
gettext-tools/src/x-lua.c
gettext-tools/src/x-perl.c
gettext-tools/src/x-php.c
gettext-tools/src/x-python.c
gettext-tools/src/x-scheme.c
gettext-tools/src/x-sh.c
gettext-tools/src/x-tcl.c
gettext-tools/src/x-vala.c
gettext-tools/src/xg-arglist-parser.c
gettext-tools/src/xg-arglist-parser.h

index 993aa3aab7a6bbb2dd7465b8f0fe5e92ba834120..0cc16186fe4bdf0358b4e5844ae40559a592ae1e 100644 (file)
@@ -32,6 +32,7 @@
 #include "message.h"
 #include "xgettext.h"
 #include "xg-pos.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -791,10 +792,16 @@ extract_parenthesized (message_list_ty *mlp,
               remember_a_message (mlp, NULL, token.string, false, inner_context,
                                   &pos, NULL, savable_comment, false);
             else
-              arglist_parser_remember (argparser, arg, token.string,
-                                       inner_context,
-                                       pos.file_name, pos.line_number,
-                                       savable_comment);
+              {
+                mixed_string_ty *ms =
+                  mixed_string_alloc_simple (token.string, lc_string,
+                                             pos.file_name, pos.line_number);
+                free (token.string);
+                arglist_parser_remember (argparser, arg, ms,
+                                         inner_context,
+                                         pos.file_name, pos.line_number,
+                                         savable_comment);
+              }
           }
           next_is_argument = false;
           next_context_iter = null_context_list_iterator;
index 09f474c240bd09129f24836433499cb46dc409cf..00f076ffd93e17c1f6321b244b0eecf66406e5ad 100644 (file)
@@ -2252,10 +2252,7 @@ extract_parenthesized (message_list_ty *mlp,
                                      arglist_parser_alloc (mlp,
                                                            state ? next_shapes : NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding =
-                xgettext_global_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -2264,9 +2261,7 @@ extract_parenthesized (message_list_ty *mlp,
           continue;
 
         case xgettext_token_type_rparen:
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_global_source_encoding;
           return false;
 
         case xgettext_token_type_comma:
@@ -2301,15 +2296,17 @@ extract_parenthesized (message_list_ty *mlp,
 
         case xgettext_token_type_string_literal:
           {
-            char *string = mixed_string_contents (token.mixed_string);
-            mixed_string_free (token.mixed_string);
             if (extract_all)
-              remember_a_message (mlp, NULL, string, true, inner_context,
-                                  &token.pos, NULL, token.comment, false);
+              {
+                char *string = mixed_string_contents (token.mixed_string);
+                mixed_string_free (token.mixed_string);
+                remember_a_message (mlp, NULL, string, true, inner_context,
+                                    &token.pos, NULL, token.comment, false);
+              }
             else
               {
                 xgettext_current_source_encoding = po_charset_utf8;
-                arglist_parser_remember (argparser, arg, string,
+                arglist_parser_remember (argparser, arg, token.mixed_string,
                                          inner_context,
                                          token.pos.file_name,
                                          token.pos.line_number,
@@ -2330,9 +2327,7 @@ extract_parenthesized (message_list_ty *mlp,
           continue;
 
         case xgettext_token_type_eof:
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_global_source_encoding;
           return true;
 
         default:
index cfa6ea622bd0e3fa201a1b83aa81e3ddfa1d55b1..963dda2daf48fd750eef007cec96808eef24c8a6 100644 (file)
@@ -1934,9 +1934,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
                                      arglist_parser_alloc (mlp,
                                                            state ? next_shapes : NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -1946,9 +1944,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
         case token_type_rparen:
           if (terminator == token_type_rparen)
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return false;
             }
           if (terminator == token_type_rbrace)
@@ -1968,9 +1964,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
                                      null_context, null_context_list_iterator,
                                      arglist_parser_alloc (mlp, NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -1980,9 +1974,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
         case token_type_rbrace:
           if (terminator == token_type_rbrace)
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return false;
             }
           if (terminator == token_type_rparen)
@@ -2009,22 +2001,22 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
 
         case token_type_string_literal:
           {
-            char *string;
             lex_pos_ty pos;
 
-            string = mixed_string_contents (token.mixed_string);
-            mixed_string_free (token.mixed_string);
-
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
             if (extract_all)
-              remember_a_message (mlp, NULL, string, true, inner_context,
-                                  &pos, NULL, token.comment, true);
+              {
+                char *string = mixed_string_contents (token.mixed_string);
+                mixed_string_free (token.mixed_string);
+                remember_a_message (mlp, NULL, string, true, inner_context,
+                                    &pos, NULL, token.comment, true);
+              }
             else
               {
                 xgettext_current_source_encoding = po_charset_utf8;
-                arglist_parser_remember (argparser, arg, string,
+                arglist_parser_remember (argparser, arg, token.mixed_string,
                                          inner_context,
                                          pos.file_name, pos.line_number,
                                          token.comment);
@@ -2037,9 +2029,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
           continue;
 
         case token_type_eof:
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_global_source_encoding;
           return true;
 
         case token_type_dot:
index 3fff84f9065e86256b53aa1e66fd8b1e1e5d07e3..b1077406107fe0486d26e3c0f4a99250df9b81ef 100644 (file)
@@ -32,6 +32,7 @@
 #include "message.h"
 #include "xgettext.h"
 #include "xg-pos.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -708,12 +709,19 @@ read_object (struct object *op, bool first_in_list, bool new_backquote_flag,
                   {
                     /* These are the argument positions.  */
                     if (argparser != NULL && inner.type == t_string)
-                      arglist_parser_remember (argparser, arg,
-                                               string_of_object (&inner),
-                                               inner_context,
-                                               logical_file_name,
-                                               inner.line_number_at_start,
-                                               savable_comment);
+                      {
+                        char *s = string_of_object (&inner);
+                        mixed_string_ty *ms =
+                          mixed_string_alloc_simple (s, lc_string,
+                                                     logical_file_name,
+                                                     inner.line_number_at_start);
+                        free (s);
+                        arglist_parser_remember (argparser, arg, ms,
+                                                 inner_context,
+                                                 logical_file_name,
+                                                 inner.line_number_at_start,
+                                                 savable_comment);
+                      }
                   }
 
                 free_object (&inner);
index e019f4e5a57c1fc6418bd49c1d90ed5627b15627..cd57c30560dcf63fc566faee5c6ebabbf83ea4b7 100644 (file)
@@ -1133,9 +1133,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
                                      arglist_parser_alloc (mlp,
                                                            state ? next_shapes : NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -1145,9 +1143,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
         case token_type_rparen:
           if (terminator == token_type_rparen)
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return false;
             }
           if (terminator == token_type_rbrace)
@@ -1167,9 +1163,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
                                      null_context, null_context_list_iterator,
                                      arglist_parser_alloc (mlp, NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -1179,9 +1173,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
         case token_type_rbrace:
           if (terminator == token_type_rbrace)
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return false;
             }
           if (terminator == token_type_rparen)
@@ -1208,22 +1200,22 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
 
         case token_type_string_literal:
           {
-            char *string;
             lex_pos_ty pos;
 
-            string = mixed_string_contents (token.mixed_string);
-            mixed_string_free (token.mixed_string);
-
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
             if (extract_all)
-              remember_a_message (mlp, NULL, string, true, inner_context,
-                                  &pos, NULL, token.comment, true);
+              {
+                char *string = mixed_string_contents (token.mixed_string);
+                mixed_string_free (token.mixed_string);
+                remember_a_message (mlp, NULL, string, true, inner_context,
+                                    &pos, NULL, token.comment, true);
+              }
             else
               {
                 xgettext_current_source_encoding = po_charset_utf8;
-                arglist_parser_remember (argparser, arg, string,
+                arglist_parser_remember (argparser, arg, token.mixed_string,
                                          inner_context,
                                          pos.file_name, pos.line_number,
                                          token.comment);
@@ -1236,9 +1228,7 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator,
           continue;
 
         case token_type_eof:
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_global_source_encoding;
           return true;
 
         case token_type_dot:
index 0dea9c07994ba67d0e2b7edce7cf090dcb292b95..27b87d4f72d9f0d4ce3b43d5632974d6493fbe9c 100644 (file)
@@ -1450,9 +1450,7 @@ extract_balanced (message_list_ty *mlp,
                                 arglist_parser_alloc (mlp,
                                                       state ? next_shapes : NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_current_file_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -1462,9 +1460,7 @@ extract_balanced (message_list_ty *mlp,
         case token_type_rparen:
           if (delim == token_type_rparen || delim == token_type_eof)
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_current_file_source_encoding;
               return false;
             }
           next_context_iter = null_context_list_iterator;
@@ -1486,9 +1482,7 @@ extract_balanced (message_list_ty *mlp,
                                 null_context, null_context_list_iterator,
                                 arglist_parser_alloc (mlp, NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_current_file_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -1498,9 +1492,7 @@ extract_balanced (message_list_ty *mlp,
         case token_type_rbracket:
           if (delim == token_type_rbracket || delim == token_type_eof)
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_current_file_source_encoding;
               return false;
             }
           next_context_iter = null_context_list_iterator;
@@ -1509,22 +1501,22 @@ extract_balanced (message_list_ty *mlp,
 
         case token_type_string:
           {
-            char *string;
             lex_pos_ty pos;
 
-            string = mixed_string_contents (token.mixed_string);
-            mixed_string_free (token.mixed_string);
-
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
             if (extract_all)
-              remember_a_message (mlp, NULL, string, true, inner_context,
-                                  &pos, NULL, token.comment, true);
+              {
+                char *string = mixed_string_contents (token.mixed_string);
+                mixed_string_free (token.mixed_string);
+                remember_a_message (mlp, NULL, string, true, inner_context,
+                                    &pos, NULL, token.comment, true);
+              }
             else
               {
                 xgettext_current_source_encoding = po_charset_utf8;
-                arglist_parser_remember (argparser, arg, string,
+                arglist_parser_remember (argparser, arg, token.mixed_string,
                                          inner_context,
                                          pos.file_name, pos.line_number,
                                          token.comment);
@@ -1537,9 +1529,7 @@ extract_balanced (message_list_ty *mlp,
           continue;
 
         case token_type_eof:
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_current_file_source_encoding;
           return true;
 
         case token_type_keyword:
index 552e58beb2242942ba3f49d88f40bc5f5f115d91..1739e6f7cf14f321a187e03317e81616cb8cff22 100644 (file)
@@ -33,6 +33,7 @@
 #include "message.h"
 #include "xgettext.h"
 #include "xg-pos.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -682,12 +683,19 @@ read_object (struct object *op, flag_context_ty outer_context)
                   {
                     /* These are the argument positions.  */
                     if (argparser != NULL && inner.type == t_string)
-                      arglist_parser_remember (argparser, arg,
-                                               string_of_object (&inner),
-                                               inner_context,
-                                               logical_file_name,
-                                               inner.line_number_at_start,
-                                               savable_comment);
+                      {
+                        char *s = string_of_object (&inner);
+                        mixed_string_ty *ms =
+                          mixed_string_alloc_simple (s, lc_string,
+                                                     logical_file_name,
+                                                     inner.line_number_at_start);
+                        free (s);
+                        arglist_parser_remember (argparser, arg, ms,
+                                                 inner_context,
+                                                 logical_file_name,
+                                                 inner.line_number_at_start,
+                                                 savable_comment);
+                      }
                   }
 
                 free_object (&inner);
index 0680c17dc9bb98ad3d4ab26ddc69f159e898efd5..41402e24dd9d9fb071ff51634d60b30e92438123 100644 (file)
@@ -32,6 +32,7 @@
 #include "message.h"
 #include "xgettext.h"
 #include "xg-pos.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -1085,12 +1086,19 @@ read_object (struct object *op, flag_context_ty outer_context)
                       {
                         /* These are the argument positions.  */
                         if (argparser != NULL && inner.type == t_string)
-                          arglist_parser_remember (argparser, arg,
-                                                   string_of_object (&inner),
-                                                   inner_context,
-                                                   logical_file_name,
-                                                   inner.line_number_at_start,
-                                                   savable_comment);
+                          {
+                            char *s = string_of_object (&inner);
+                            mixed_string_ty *ms =
+                              mixed_string_alloc_simple (s, lc_string,
+                                                         logical_file_name,
+                                                         inner.line_number_at_start);
+                            free (s);
+                            arglist_parser_remember (argparser, arg, ms,
+                                                     inner_context,
+                                                     logical_file_name,
+                                                     inner.line_number_at_start,
+                                                     savable_comment);
+                          }
                       }
 
                     free_object (&inner);
index f45d3e029e75bf7009fbfcb2261d2b605195337e..55b46ad4ab2441f6f9f6ccf428d959cfdb854a42 100644 (file)
@@ -32,6 +32,7 @@
 #include "rc-str-list.h"
 #include "xgettext.h"
 #include "xg-pos.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -1149,19 +1150,23 @@ extract_balanced (message_list_ty *mlp, token_type_ty delim,
                                   &pos, NULL, token.comment, false);
             else
               {
+                mixed_string_ty *ms =
+                  mixed_string_alloc_simple (token.string, lc_string,
+                                             pos.file_name, pos.line_number);
+                free (token.string);
                 /* A string immediately after a symbol means a function call.  */
                 if (state)
                   {
                     struct arglist_parser *tmp_argparser;
                     tmp_argparser = arglist_parser_alloc (mlp, next_shapes);
 
-                    arglist_parser_remember (tmp_argparser, 1, token.string,
+                    arglist_parser_remember (tmp_argparser, 1, ms,
                                              inner_context, pos.file_name,
                                              pos.line_number, token.comment);
                     arglist_parser_done (tmp_argparser, 1);
                   }
                 else
-                  arglist_parser_remember (argparser, arg, token.string,
+                  arglist_parser_remember (argparser, arg, ms,
                                            inner_context, pos.file_name,
                                            pos.line_number, token.comment);
               }
index f2b4365f080d9add59b0c7d27f66d634efaeb235..818ad27ca55595570edc3642ee01c25d84a96817 100644 (file)
@@ -34,6 +34,7 @@
 #include "xgettext.h"
 #include "xg-pos.h"
 #include "xg-encoding.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -3066,9 +3067,7 @@ extract_balanced (message_list_ty *mlp,
 
       if (delim == tp->type)
         {
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_global_source_encoding;
           if (next_argparser != NULL)
             free (next_argparser);
 #if DEBUG_PERL
@@ -3085,9 +3084,7 @@ extract_balanced (message_list_ty *mlp,
 
       if (comma_delim && tp->type == token_type_comma)
         {
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_global_source_encoding;
           if (next_argparser != NULL)
             free (next_argparser);
 #if DEBUG_PERL
@@ -3137,9 +3134,7 @@ extract_balanced (message_list_ty *mlp,
                                 inner_context, next_context_iter,
                                 1, next_argparser))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return true;
             }
 
@@ -3223,9 +3218,7 @@ extract_balanced (message_list_ty *mlp,
                                     inner_context, next_context_iter,
                                     1, next_argparser))
                 {
-                  xgettext_current_source_encoding = po_charset_utf8;
                   arglist_parser_done (argparser, arg);
-                  xgettext_current_source_encoding = xgettext_global_source_encoding;
                   return true;
                 }
               next_is_argument = false;
@@ -3238,9 +3231,7 @@ extract_balanced (message_list_ty *mlp,
                                     inner_context, next_context_iter,
                                     arg, arglist_parser_clone (argparser)))
                 {
-                  xgettext_current_source_encoding = po_charset_utf8;
                   arglist_parser_done (argparser, arg);
-                  xgettext_current_source_encoding = xgettext_global_source_encoding;
                   if (next_argparser != NULL)
                     free (next_argparser);
                   free_token (tp);
@@ -3277,9 +3268,7 @@ extract_balanced (message_list_ty *mlp,
           if (arglist_parser_decidedp (argparser, arg))
             {
               /* We have missed the argument.  */
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               argparser = arglist_parser_alloc (mlp, NULL);
               arg = 0;
             }
@@ -3339,10 +3328,12 @@ extract_balanced (message_list_ty *mlp,
               if (must_collect)
                 {
                   char *string = collect_message (mlp, tp, EXIT_FAILURE);
-
+                  mixed_string_ty *ms =
+                    mixed_string_alloc_utf8 (string, lc_string,
+                                             logical_file_name, tp->line_number);
+                  free (string);
                   xgettext_current_source_encoding = po_charset_utf8;
-                  arglist_parser_remember (argparser, arg,
-                                           string, inner_context,
+                  arglist_parser_remember (argparser, arg, ms, inner_context,
                                            logical_file_name, tp->line_number,
                                            tp->comment);
                   xgettext_current_source_encoding = xgettext_global_source_encoding;
@@ -3351,9 +3342,7 @@ extract_balanced (message_list_ty *mlp,
 
           if (arglist_parser_decidedp (argparser, arg))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               argparser = arglist_parser_alloc (mlp, NULL);
             }
 
@@ -3381,9 +3370,7 @@ extract_balanced (message_list_ty *mlp,
           fprintf (stderr, "%s:%d: type EOF (%d)\n",
                    logical_file_name, tp->line_number, nesting_level);
 #endif
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_global_source_encoding;
           if (next_argparser != NULL)
             free (next_argparser);
           next_argparser = NULL;
@@ -3399,9 +3386,7 @@ extract_balanced (message_list_ty *mlp,
                                 null_context, null_context_list_iterator,
                                 1, arglist_parser_alloc (mlp, NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               if (next_argparser != NULL)
                 free (next_argparser);
               free_token (tp);
@@ -3435,9 +3420,7 @@ extract_balanced (message_list_ty *mlp,
                                 null_context, null_context_list_iterator,
                                 1, arglist_parser_alloc (mlp, NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               if (next_argparser != NULL)
                 free (next_argparser);
               free_token (tp);
@@ -3469,9 +3452,7 @@ extract_balanced (message_list_ty *mlp,
 #endif
 
           /* The ultimate sign.  */
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_global_source_encoding;
           argparser = arglist_parser_alloc (mlp, NULL);
 
           /* FIXME: Instead of resetting outer_context here, it may be better
index 1c5b1092f80a9305b1ef6ab5fa1bd093c868bba2..ecb689bdb90d3f53f3f26e13b2a7700be4cdab4d 100644 (file)
@@ -32,6 +32,7 @@
 #include "rc-str-list.h"
 #include "xgettext.h"
 #include "xg-pos.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -1534,10 +1535,15 @@ extract_balanced (message_list_ty *mlp,
               remember_a_message (mlp, NULL, token.string, false, inner_context,
                                   &pos, NULL, token.comment, false);
             else
-              arglist_parser_remember (argparser, arg, token.string,
-                                       inner_context,
-                                       pos.file_name, pos.line_number,
-                                       token.comment);
+              {
+                mixed_string_ty *ms =
+                  mixed_string_alloc_simple (token.string, lc_string,
+                                             pos.file_name, pos.line_number);
+                free (token.string);
+                arglist_parser_remember (argparser, arg, ms, inner_context,
+                                         pos.file_name, pos.line_number,
+                                         token.comment);
+              }
             drop_reference (token.comment);
           }
           next_context_iter = null_context_list_iterator;
index 19f584678d30d54562e2c5096b8ae86f558c5dd5..fb1a4f1d9e437fa5200b33758eeb3429c64517e6 100644 (file)
@@ -1565,9 +1565,7 @@ extract_balanced (message_list_ty *mlp,
                                 arglist_parser_alloc (mlp,
                                                       state ? next_shapes : NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_current_file_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -1577,9 +1575,7 @@ extract_balanced (message_list_ty *mlp,
         case token_type_rparen:
           if (delim == token_type_rparen || delim == token_type_eof)
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_current_file_source_encoding;
               return false;
             }
           next_context_iter = null_context_list_iterator;
@@ -1601,9 +1597,7 @@ extract_balanced (message_list_ty *mlp,
                                 null_context, null_context_list_iterator,
                                 arglist_parser_alloc (mlp, NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_current_file_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -1613,9 +1607,7 @@ extract_balanced (message_list_ty *mlp,
         case token_type_rbracket:
           if (delim == token_type_rbracket || delim == token_type_eof)
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_current_file_source_encoding;
               return false;
             }
           next_context_iter = null_context_list_iterator;
@@ -1624,22 +1616,22 @@ extract_balanced (message_list_ty *mlp,
 
         case token_type_string:
           {
-            char *string;
             lex_pos_ty pos;
 
-            string = mixed_string_contents (token.mixed_string);
-            mixed_string_free (token.mixed_string);
-
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
             if (extract_all)
-              remember_a_message (mlp, NULL, string, true, inner_context,
-                                  &pos, NULL, token.comment, true);
+              {
+                char *string = mixed_string_contents (token.mixed_string);
+                mixed_string_free (token.mixed_string);
+                remember_a_message (mlp, NULL, string, true, inner_context,
+                                    &pos, NULL, token.comment, true);
+              }
             else
               {
                 xgettext_current_source_encoding = po_charset_utf8;
-                arglist_parser_remember (argparser, arg, string,
+                arglist_parser_remember (argparser, arg, token.mixed_string,
                                          inner_context,
                                          pos.file_name, pos.line_number,
                                          token.comment);
@@ -1652,9 +1644,7 @@ extract_balanced (message_list_ty *mlp,
           continue;
 
         case token_type_eof:
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_current_file_source_encoding;
           return true;
 
         case token_type_plus:
index 2856b6a80024297a6d1dcbf4d3e38f20e057e49c..955ca7468fed8c8a5eef6eecb4cd5ca860949f4c 100644 (file)
@@ -32,6 +32,7 @@
 #include "message.h"
 #include "xgettext.h"
 #include "xg-pos.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -789,12 +790,19 @@ read_object (struct object *op, flag_context_ty outer_context)
                   {
                     /* These are the argument positions.  */
                     if (argparser != NULL && inner.type == t_string)
-                      arglist_parser_remember (argparser, arg,
-                                               string_of_object (&inner),
-                                               inner_context,
-                                               logical_file_name,
-                                               inner.line_number_at_start,
-                                               savable_comment);
+                      {
+                        char *s = string_of_object (&inner);
+                        mixed_string_ty *ms =
+                          mixed_string_alloc_simple (s, lc_string,
+                                                     logical_file_name,
+                                                     inner.line_number_at_start);
+                        free (s);
+                        arglist_parser_remember (argparser, arg, ms,
+                                                 inner_context,
+                                                 logical_file_name,
+                                                 inner.line_number_at_start,
+                                                 savable_comment);
+                      }
                   }
 
                 free_object (&inner);
index 75f1708169168c93bff8494b8066dcee423cd90f..6980a4222fa8f946093d7e8aa42e59266973a8ba 100644 (file)
@@ -32,6 +32,7 @@
 #include "message.h"
 #include "xgettext.h"
 #include "xg-pos.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -1318,9 +1319,14 @@ read_command (int looking_for, flag_context_ty outer_context)
                          && memcmp (argparser->keyword, "ngettext", 8) == 0));
                   if (accepts_context && argparser->next_is_msgctxt)
                     {
+                      char *s = string_of_word (&inner);
+                      mixed_string_ty *ms =
+                        mixed_string_alloc_simple (s, lc_string,
+                                                   logical_file_name,
+                                                   inner.line_number_at_start);
+                      free (s);
                       argparser->next_is_msgctxt = false;
-                      arglist_parser_remember_msgctxt (argparser,
-                                                       string_of_word (&inner),
+                      arglist_parser_remember_msgctxt (argparser, ms,
                                                        inner_context,
                                                        logical_file_name,
                                                        inner.line_number_at_start);
@@ -1339,9 +1345,14 @@ read_command (int looking_for, flag_context_ty outer_context)
                            && (inner.token->charcount >= 10
                                && memcmp (inner.token->chars, "--context=", 10) == 0))
                     {
+                      char *s = substring_of_word (&inner, 10);
+                      mixed_string_ty *ms =
+                        mixed_string_alloc_simple (s, lc_string,
+                                                   logical_file_name,
+                                                   inner.line_number_at_start);
+                      free (s);
                       argparser->next_is_msgctxt = false;
-                      arglist_parser_remember_msgctxt (argparser,
-                                                       substring_of_word (&inner, 10),
+                      arglist_parser_remember_msgctxt (argparser, ms,
                                                        inner_context,
                                                        logical_file_name,
                                                        inner.line_number_at_start);
@@ -1349,8 +1360,13 @@ read_command (int looking_for, flag_context_ty outer_context)
                     }
                   else
                     {
-                      arglist_parser_remember (argparser, arg,
-                                               string_of_word (&inner),
+                      char *s = string_of_word (&inner);
+                      mixed_string_ty *ms =
+                        mixed_string_alloc_simple (s, lc_string,
+                                                   logical_file_name,
+                                                   inner.line_number_at_start);
+                      free (s);
+                      arglist_parser_remember (argparser, arg, ms,
                                                inner_context,
                                                logical_file_name,
                                                inner.line_number_at_start,
index 43704c7d058993fb98d98c69a9962bddac90df12..e67d94a57d0bb8f2297a097383499a991de4c157 100644 (file)
@@ -35,6 +35,7 @@
 #include "xgettext.h"
 #include "xg-pos.h"
 #include "xg-encoding.h"
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 #include "xg-arglist-parser.h"
@@ -930,12 +931,19 @@ read_command (int looking_for, flag_context_ty outer_context)
           {
             /* These are the argument positions.  */
             if (argparser != NULL && inner.type == t_string)
-              arglist_parser_remember (argparser, arg,
-                                       string_of_word (&inner),
-                                       inner_context,
-                                       logical_file_name,
-                                       inner.line_number_at_start,
-                                       savable_comment);
+              {
+                char *s = string_of_word (&inner);
+                mixed_string_ty *ms =
+                  mixed_string_alloc_simple (s, lc_string,
+                                             logical_file_name,
+                                             inner.line_number_at_start);
+                free (s);
+                arglist_parser_remember (argparser, arg, ms,
+                                         inner_context,
+                                         logical_file_name,
+                                         inner.line_number_at_start,
+                                         savable_comment);
+              }
           }
 
         free_word (&inner);
index c0347693e9cd7c0177343b72dfed10ab0a190f55..2c5f34509e4dfaf40cf631b1367a8fd947d0a3bb 100644 (file)
@@ -1281,9 +1281,7 @@ extract_balanced (message_list_ty *mlp, token_type_ty delim,
                                 arglist_parser_alloc (mlp,
                                                       state ? next_shapes : NULL)))
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return true;
             }
           next_context_iter = null_context_list_iterator;
@@ -1293,9 +1291,7 @@ extract_balanced (message_list_ty *mlp, token_type_ty delim,
         case token_type_rparen:
           if (delim == token_type_rparen || delim == token_type_eof)
             {
-              xgettext_current_source_encoding = po_charset_utf8;
               arglist_parser_done (argparser, arg);
-              xgettext_current_source_encoding = xgettext_global_source_encoding;
               return false;
             }
 
@@ -1314,44 +1310,46 @@ extract_balanced (message_list_ty *mlp, token_type_ty delim,
           continue;
 
         case token_type_eof:
-          xgettext_current_source_encoding = po_charset_utf8;
           arglist_parser_done (argparser, arg);
-          xgettext_current_source_encoding = xgettext_global_source_encoding;
           return true;
 
         case token_type_string_literal:
           {
-            char *string;
             lex_pos_ty pos;
 
-            string = mixed_string_contents (token.mixed_string);
-            mixed_string_free (token.mixed_string);
-
             pos.file_name = logical_file_name;
             pos.line_number = token.line_number;
 
             if (extract_all)
-              remember_a_message (mlp, NULL, string, true, inner_context,
-                                  &pos, NULL, token.comment, false);
+              {
+                char *string = mixed_string_contents (token.mixed_string);
+                mixed_string_free (token.mixed_string);
+                remember_a_message (mlp, NULL, string, true, inner_context,
+                                    &pos, NULL, token.comment, false);
+              }
             else
               {
-                xgettext_current_source_encoding = po_charset_utf8;
                 /* A string immediately after a symbol means a function call.  */
                 if (state)
                   {
                     struct arglist_parser *tmp_argparser;
                     tmp_argparser = arglist_parser_alloc (mlp, next_shapes);
 
-                    arglist_parser_remember (tmp_argparser, 1, string,
+                    xgettext_current_source_encoding = po_charset_utf8;
+                    arglist_parser_remember (tmp_argparser, 1, token.mixed_string,
                                              inner_context, pos.file_name,
                                              pos.line_number, token.comment);
+                    xgettext_current_source_encoding = xgettext_global_source_encoding;
                     arglist_parser_done (tmp_argparser, 1);
                   }
                 else
-                  arglist_parser_remember (argparser, arg, string,
-                                           inner_context, pos.file_name,
-                                           pos.line_number, token.comment);
-                xgettext_current_source_encoding = xgettext_global_source_encoding;
+                  {
+                    xgettext_current_source_encoding = po_charset_utf8;
+                    arglist_parser_remember (argparser, arg, token.mixed_string,
+                                             inner_context, pos.file_name,
+                                             pos.line_number, token.comment);
+                    xgettext_current_source_encoding = xgettext_global_source_encoding;
+                  }
               }
           }
           drop_reference (token.comment);
index f15eee713c15efe81ca433fb19229020e98f3591..37647d7e4b2486cd207ccae4124c8f0dc260556c 100644 (file)
@@ -124,14 +124,15 @@ arglist_parser_clone (struct arglist_parser *ap)
       ccp->argnum2_glib_context = cp->argnum2_glib_context;
       ccp->argtotal = cp->argtotal;
       ccp->xcomments = cp->xcomments;
-      ccp->msgctxt = (cp->msgctxt != NULL ? xstrdup (cp->msgctxt) : NULL);
+      ccp->msgctxt =
+        (cp->msgctxt != NULL ? mixed_string_clone (cp->msgctxt) : NULL);
       ccp->msgctxt_pos = cp->msgctxt_pos;
-      ccp->msgid = (cp->msgid != NULL ? xstrdup (cp->msgid) : NULL);
+      ccp->msgid = (cp->msgid != NULL ? mixed_string_clone (cp->msgid) : NULL);
       ccp->msgid_context = cp->msgid_context;
       ccp->msgid_pos = cp->msgctxt_pos;
       ccp->msgid_comment = add_reference (cp->msgid_comment);
       ccp->msgid_plural =
-        (cp->msgid_plural != NULL ? xstrdup (cp->msgid_plural) : NULL);
+        (cp->msgid_plural != NULL ? mixed_string_clone (cp->msgid_plural) : NULL);
       ccp->msgid_plural_context = cp->msgid_plural_context;
       ccp->msgid_plural_pos = cp->msgid_plural_pos;
     }
@@ -142,7 +143,7 @@ arglist_parser_clone (struct arglist_parser *ap)
 
 void
 arglist_parser_remember (struct arglist_parser *ap,
-                         int argnum, char *string,
+                         int argnum, mixed_string_ty *string,
                          flag_context_ty context,
                          char *file_name, size_t line_number,
                          refcounted_string_list_ty *comment)
@@ -194,13 +195,13 @@ arglist_parser_remember (struct arglist_parser *ap,
   /* Note: There is a memory leak here: When string was stored but is later
      not used by arglist_parser_done, we don't free it.  */
   if (!stored_string)
-    free (string);
+    mixed_string_free (string);
 }
 
 
 void
 arglist_parser_remember_msgctxt (struct arglist_parser *ap,
-                                 char *string,
+                                 mixed_string_ty *string,
                                  flag_context_ty context,
                                  char *file_name, size_t line_number)
 {
@@ -222,7 +223,7 @@ arglist_parser_remember_msgctxt (struct arglist_parser *ap,
   /* Note: There is a memory leak here: When string was stored but is later
      not used by arglist_parser_done, we don't free it.  */
   if (!stored_string)
-    free (string);
+    mixed_string_free (string);
 }
 
 
@@ -389,17 +390,52 @@ arglist_parser_done (struct arglist_parser *ap, int argnum)
         {
           /* best_cp indicates the best found complete call.
              Now call remember_a_message.  */
+          flag_context_ty msgid_context;
+          flag_context_ty msgid_plural_context;
+          char *best_msgctxt;
+          char *best_msgid;
+          char *best_msgid_plural;
           message_ty *mp;
 
+          msgid_context = best_cp->msgid_context;
+          msgid_plural_context = best_cp->msgid_plural_context;
+
+          /* Special support for the 3-argument tr operator in Qt:
+             When --qt and --keyword=tr:1,1,2c,3t are specified, add to the
+             context the information that the argument is expected to be a
+             qt-plural-format.  */
+          if (recognize_qt_formatstrings ()
+              && best_cp->msgid_plural == best_cp->msgid)
+            {
+              msgid_context.is_format3 = yes_according_to_context;
+              msgid_plural_context.is_format3 = yes_according_to_context;
+            }
+
+          best_msgctxt =
+            (best_cp->msgctxt != NULL
+             ? mixed_string_contents_free1 (best_cp->msgctxt)
+             : NULL);
+          best_msgid =
+            (best_cp->msgid != NULL
+             ? mixed_string_contents_free1 (best_cp->msgid)
+             : NULL);
+          best_msgid_plural =
+            (best_cp->msgid_plural != NULL
+             ? /* Special support for the 3-argument tr operator in Qt.  */
+               (best_cp->msgid_plural == best_cp->msgid
+                ? xstrdup (best_msgid)
+                : mixed_string_contents_free1 (best_cp->msgid_plural))
+             : NULL);
+
           /* Split strings in the GNOME glib syntax "msgctxt|msgid".  */
           if (best_cp->argnum1_glib_context || best_cp->argnum2_glib_context)
             /* split_keywordspec should not allow the context to be specified
                in two different ways.  */
-            if (best_cp->msgctxt != NULL)
+            if (best_msgctxt != NULL)
               abort ();
           if (best_cp->argnum1_glib_context)
             {
-              const char *separator = strchr (best_cp->msgid, '|');
+              const char *separator = strchr (best_msgid, '|');
 
               if (separator == NULL)
                 {
@@ -413,18 +449,18 @@ arglist_parser_done (struct arglist_parser *ap, int argnum)
                 }
               else
                 {
-                  size_t ctxt_len = separator - best_cp->msgid;
+                  size_t ctxt_len = separator - best_msgid;
                   char *ctxt = XNMALLOC (ctxt_len + 1, char);
 
-                  memcpy (ctxt, best_cp->msgid, ctxt_len);
+                  memcpy (ctxt, best_msgid, ctxt_len);
                   ctxt[ctxt_len] = '\0';
-                  best_cp->msgctxt = ctxt;
-                  best_cp->msgid = xstrdup (separator + 1);
+                  best_msgctxt = ctxt;
+                  best_msgid = xstrdup (separator + 1);
                 }
             }
-          if (best_cp->msgid_plural != NULL && best_cp->argnum2_glib_context)
+          if (best_msgid_plural != NULL && best_cp->argnum2_glib_context)
             {
-              const char *separator = strchr (best_cp->msgid_plural, '|');
+              const char *separator = strchr (best_msgid_plural, '|');
 
               if (separator == NULL)
                 {
@@ -438,16 +474,16 @@ arglist_parser_done (struct arglist_parser *ap, int argnum)
                 }
               else
                 {
-                  size_t ctxt_len = separator - best_cp->msgid_plural;
+                  size_t ctxt_len = separator - best_msgid_plural;
                   char *ctxt = XNMALLOC (ctxt_len + 1, char);
 
-                  memcpy (ctxt, best_cp->msgid_plural, ctxt_len);
+                  memcpy (ctxt, best_msgid_plural, ctxt_len);
                   ctxt[ctxt_len] = '\0';
-                  if (best_cp->msgctxt == NULL)
-                    best_cp->msgctxt = ctxt;
+                  if (best_msgctxt == NULL)
+                    best_msgctxt = ctxt;
                   else
                     {
-                      if (strcmp (ctxt, best_cp->msgctxt) != 0)
+                      if (strcmp (ctxt, best_msgctxt) != 0)
                         {
                           error_with_progname = false;
                           error_at_line (0, 0,
@@ -458,35 +494,19 @@ arglist_parser_done (struct arglist_parser *ap, int argnum)
                         }
                       free (ctxt);
                     }
-                  best_cp->msgid_plural = xstrdup (separator + 1);
+                  best_msgid_plural = xstrdup (separator + 1);
                 }
             }
 
-          {
-            flag_context_ty msgid_context = best_cp->msgid_context;
-            flag_context_ty msgid_plural_context = best_cp->msgid_plural_context;
-
-            /* Special support for the 3-argument tr operator in Qt:
-               When --qt and --keyword=tr:1,1,2c,3t are specified, add to the
-               context the information that the argument is expected to be a
-               qt-plural-format.  */
-            if (recognize_qt_formatstrings ()
-                && best_cp->msgid_plural == best_cp->msgid)
-              {
-                msgid_context.is_format3 = yes_according_to_context;
-                msgid_plural_context.is_format3 = yes_according_to_context;
-              }
-
-            mp = remember_a_message (ap->mlp, best_cp->msgctxt, best_cp->msgid,
-                                     false, msgid_context,
-                                     &best_cp->msgid_pos,
-                                     NULL, best_cp->msgid_comment, false);
-            if (mp != NULL && best_cp->msgid_plural != NULL)
-              remember_a_message_plural (mp, best_cp->msgid_plural, false,
-                                         msgid_plural_context,
-                                         &best_cp->msgid_plural_pos,
-                                         NULL, false);
-          }
+          mp = remember_a_message (ap->mlp, best_msgctxt, best_msgid, true,
+                                   msgid_context,
+                                   &best_cp->msgid_pos,
+                                   NULL, best_cp->msgid_comment, false);
+          if (mp != NULL && best_msgid_plural != NULL)
+            remember_a_message_plural (mp, best_msgid_plural, true,
+                                       msgid_plural_context,
+                                       &best_cp->msgid_plural_pos,
+                                       NULL, false);
 
           if (best_cp->xcomments.nitems > 0)
             {
index bad14fcad4cefb3e6776b923b1eb65537a83cfe1..b6d31145cd3c796c3670e102deb2cbcc8d44f9d2 100644 (file)
@@ -25,6 +25,7 @@
 #include "rc-str-list.h"
 #include "str-list.h"
 
+#include "xg-mixed-string.h"
 #include "xg-arglist-context.h"
 #include "xg-arglist-callshape.h"
 
@@ -44,13 +45,13 @@ struct partial_call
   bool argnum2_glib_context;    /* argument argnum2 has the syntax "ctxt|msgid" */
   int argtotal;                 /* total number of arguments, 0 if unspecified */
   string_list_ty xcomments;     /* auto-extracted comments */
-  char *msgctxt;                /* context - owned string, or NULL */
+  mixed_string_ty *msgctxt;     /* context - owned mixed_string, or NULL */
   lex_pos_ty msgctxt_pos;
-  char *msgid;                  /* msgid - owned string, or NULL */
+  mixed_string_ty *msgid;       /* msgid - owned mixed_string, or NULL */
   flag_context_ty msgid_context;
   lex_pos_ty msgid_pos;
   refcounted_string_list_ty *msgid_comment;
-  char *msgid_plural;           /* msgid_plural - owned string, or NULL */
+  mixed_string_ty *msgid_plural; /* msgid_plural - owned mixed_string, or NULL */
   flag_context_ty msgid_plural_context;
   lex_pos_ty msgid_plural_pos;
 };
@@ -74,22 +75,22 @@ extern struct arglist_parser * arglist_parser_alloc (message_list_ty *mlp,
 /* Clones an arglist_parser.  */
 extern struct arglist_parser * arglist_parser_clone (struct arglist_parser *ap);
 /* Adds a string argument to an arglist_parser.  ARGNUM must be > 0.
-   STRING must be malloc()ed string; its ownership is passed to the callee.
+   STRING must be a mixed_string; its ownership is passed to the callee.
    FILE_NAME must be allocated with indefinite extent.
    COMMENT may be savable_comment, or it may be a saved copy of savable_comment
    (then add_reference must be used when saving it, and drop_reference while
    dropping it).  Clear savable_comment.  */
 extern void arglist_parser_remember (struct arglist_parser *ap,
-                                     int argnum, char *string,
+                                     int argnum, mixed_string_ty *string,
                                      flag_context_ty context,
                                      char *file_name, size_t line_number,
                                      refcounted_string_list_ty *comment);
 /* Adds a string argument as msgctxt to an arglist_parser, without incrementing
    the current argument number.
-   STRING must be malloc()ed string; its ownership is passed to the callee.
+   STRING must be a mixed_string; its ownership is passed to the callee.
    FILE_NAME must be allocated with indefinite extent.  */
 extern void arglist_parser_remember_msgctxt (struct arglist_parser *ap,
-                                             char *string,
+                                             mixed_string_ty *string,
                                              flag_context_ty context,
                                              char *file_name, size_t line_number);
 /* Tests whether an arglist_parser has is not waiting for more arguments after