]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Silence "use of possibly-NULL ‘msgstr’" warnings.
authorBruno Haible <bruno@clisp.org>
Fri, 2 Jun 2023 23:33:08 +0000 (01:33 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Jun 2023 13:54:10 +0000 (15:54 +0200)
* gettext-tools/src/write-po.c: Include verify.h.
(message_print_comment_filepos): Assume that this xasprintf call returns
non-NULL.
* gettext-tools/src/xg-message.c: Include verify.h.
(remember_a_message, remember_a_message_plural): Assume that this xasprintf call
returns non-NULL.
* gettext-tools/src/xgettext.c: Include verify.h.
(construct_header): Assume that this xasprintf call returns non-NULL.

gettext-tools/src/write-po.c
gettext-tools/src/xg-message.c
gettext-tools/src/xgettext.c

index 0c9623ffbef7f110e1ef25e1f8c77e92407630a9..7bc4ee6928d10b3dc1c4e0cbb81097281951a983 100644 (file)
@@ -48,6 +48,7 @@
 #include "xmalloca.h"
 #include "c-strstr.h"
 #include "xvasprintf.h"
+#include "verify.h"
 #include "po-xerror.h"
 #include "gettext.h"
 
@@ -366,6 +367,7 @@ message_print_comment_filepos (const message_ty *mp, ostream_t stream,
                  Solaris.  Use the Solaris form here.  */
               str = xasprintf ("File: %s, line: %ld",
                                cp, (long) pp->line_number);
+              assume (str != NULL);
               ostream_write_str (stream, str);
               end_css_class (stream, class_reference);
               ostream_write_str (stream, "\n");
index 281768768771a3b6f7250f6a5b163e926ac4a3f7..88d215e682a2e7b20ff4397b6f9f4a488ab41e31 100644 (file)
@@ -30,6 +30,7 @@
 #include "xalloc.h"
 #include "xerror.h"
 #include "xvasprintf.h"
+#include "verify.h"
 
 #include "xgettext.h"
 
@@ -358,7 +359,10 @@ meta information, not the empty string.\n")));
       /* Construct the msgstr from the prefix and suffix, otherwise use the
          empty string.  */
       if (msgstr_prefix)
-        msgstr = xasprintf ("%s%s%s", msgstr_prefix, msgid, msgstr_suffix);
+        {
+          msgstr = xasprintf ("%s%s%s", msgstr_prefix, msgid, msgstr_suffix);
+          assume (msgstr != NULL);
+        }
       else
         msgstr = "";
 
@@ -585,6 +589,7 @@ remember_a_message_plural (message_ty *mp, char *string, bool is_utf8,
           msgstr1_malloc =
             xasprintf ("%s%s%s", msgstr_prefix, msgid_plural, msgstr_suffix);
           msgstr1 = msgstr1_malloc;
+          assume (msgstr1 != NULL);
         }
       else
         msgstr1 = "";
index cbfa9fe39c8c5cb4e8f8c3fc3f3a969bdaa24c29..dc1215d391799a3fbe7a4e8ffdeb7a67aef6ed3b 100644 (file)
@@ -59,6 +59,7 @@
 #include "xvasprintf.h"
 #include "xalloc.h"
 #include "xmalloca.h"
+#include "verify.h"
 #include "c-strstr.h"
 #include "xerror.h"
 #include "filename.h"
@@ -2038,6 +2039,7 @@ Content-Transfer-Encoding: 8bit\n",
                       project_id_version,
                       msgid_bugs_address != NULL ? msgid_bugs_address : "",
                       timestring);
+  assume (msgstr != NULL);
   free (timestring);
   free (project_id_version);