From: Bruno Haible Date: Fri, 2 Jun 2023 23:33:08 +0000 (+0200) Subject: Silence "use of possibly-NULL ‘msgstr’" warnings. X-Git-Tag: v0.22~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b10d3e6531d534c28fbbb361cd404461faef2102;p=thirdparty%2Fgettext.git Silence "use of possibly-NULL ‘msgstr’" warnings. * 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. --- diff --git a/gettext-tools/src/write-po.c b/gettext-tools/src/write-po.c index 0c9623ffb..7bc4ee692 100644 --- a/gettext-tools/src/write-po.c +++ b/gettext-tools/src/write-po.c @@ -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"); diff --git a/gettext-tools/src/xg-message.c b/gettext-tools/src/xg-message.c index 281768768..88d215e68 100644 --- a/gettext-tools/src/xg-message.c +++ b/gettext-tools/src/xg-message.c @@ -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 = ""; diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c index cbfa9fe39..dc1215d39 100644 --- a/gettext-tools/src/xgettext.c +++ b/gettext-tools/src/xgettext.c @@ -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);