From 852bdf44cd721d36ad7e634b0ada442e4fab4c90 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 25 Jun 2020 17:38:25 +0200 Subject: [PATCH] Remove redundant code. * 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 | 17 +++++++---------- gettext-tools/src/write-qt.c | 19 ++++++++----------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/gettext-tools/src/write-mo.c b/gettext-tools/src/write-mo.c index 41b32c7aa..36984ac1c 100644 --- a/gettext-tools/src/write-mo.c +++ b/gettext-tools/src/write-mo.c @@ -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; diff --git a/gettext-tools/src/write-qt.c b/gettext-tools/src/write-qt.c index b03ac81d3..669147e1e 100644 --- a/gettext-tools/src/write-qt.c +++ b/gettext-tools/src/write-qt.c @@ -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 , 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; -- 2.47.3