]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Remove redundant code.
authorBruno Haible <bruno@clisp.org>
Thu, 25 Jun 2020 15:38:25 +0000 (17:38 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 3 Jul 2020 21:05:49 +0000 (23:05 +0200)
* gettext-tools/src/write-mo.c (msgdomain_write_mo): Remove a redundant test.
* gettext-tools/src/write-qt.c (msgdomain_write_qt): Likewise.

gettext-tools/src/write-mo.c
gettext-tools/src/write-qt.c

index 41b32c7aa428221ee856e1645a80cd8a56a902be..36984ac1c8518660955c37c801fe413e745fa4bf 100644 (file)
@@ -782,11 +782,11 @@ msgdomain_write_mo (message_list_ty *mlp,
                     const char *domain_name,
                     const char *file_name)
 {
-  FILE *output_file;
-
   /* If no entry for this domain don't even create the file.  */
   if (mlp->nitems != 0)
     {
+      FILE *output_file;
+
       /* Support for "reproducible builds": Delete information that may vary
          between builds in the same conditions.  */
       message_list_delete_header_field (mlp, "POT-Creation-Date:");
@@ -807,15 +807,12 @@ msgdomain_write_mo (message_list_ty *mlp,
             }
         }
 
-      if (output_file != NULL)
-        {
-          write_table (output_file, mlp);
+      write_table (output_file, mlp);
 
-          /* Make sure nothing went wrong.  */
-          if (fwriteerror (output_file))
-            error (EXIT_FAILURE, errno, _("error while writing \"%s\" file"),
-                   file_name);
-        }
+      /* Make sure nothing went wrong.  */
+      if (fwriteerror (output_file))
+        error (EXIT_FAILURE, errno, _("error while writing \"%s\" file"),
+               file_name);
     }
 
   return 0;
index b03ac81d3ee7f5825424c059d9a9af08f3e79d1f..669147e1e2bf69a518344c6c0734cf65fd565b6f 100644 (file)
@@ -1,5 +1,5 @@
 /* Writing Qt .qm files.
-   Copyright (C) 2003, 2005-2007, 2009, 2016 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005-2007, 2009, 2016, 2020 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -648,11 +648,11 @@ int
 msgdomain_write_qt (message_list_ty *mlp, const char *canon_encoding,
                     const char *domain_name, const char *file_name)
 {
-  FILE *output_file;
-
   /* If no entry for this domain don't even create the file.  */
   if (mlp->nitems != 0)
     {
+      FILE *output_file;
+
       /* Determine whether mlp has plural entries.  */
       {
         bool has_plural;
@@ -744,15 +744,12 @@ strings, not in the untranslated strings\n")));
             }
         }
 
-      if (output_file != NULL)
-        {
-          write_qm (output_file, mlp);
+      write_qm (output_file, mlp);
 
-          /* Make sure nothing went wrong.  */
-          if (fwriteerror (output_file))
-            error (EXIT_FAILURE, errno, _("error while writing \"%s\" file"),
-                   file_name);
-        }
+      /* Make sure nothing went wrong.  */
+      if (fwriteerror (output_file))
+        error (EXIT_FAILURE, errno, _("error while writing \"%s\" file"),
+               file_name);
     }
 
   return 0;