[Pkg-gnupg-commit] [gnupg2] 195/241: gpg: Avoid extra translation strings.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Dec 9 20:32:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 686f31c3d5aee0d2825265869ae92ca95cdcabae
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Nov 27 18:23:33 2015 +0100

    gpg: Avoid extra translation strings.
    
    * g10/keyedit.c (menu_expire): Use only one prompt.
    --
    
    The old code was anyway not fully i18n because it did not used
    ngettext.  Further we ran into const char*/char* conflicts on Windows
    where we use a different gettext implementation.
    
    FWIW: A better pattern in the case of a static and a malloced string
    w/o error return on malloc failure would be:
    
      const char *s;
      char *s_buf;
      s_buf = xtryasprintf ("%d foo", n);
      if (!s_buf)
        s = "several foo";
      else
        s = s_buf;
      bar (s);
      xfree (s_buf);
---
 g10/keyedit.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/g10/keyedit.c b/g10/keyedit.c
index 9cf6f44..d7c70e6 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -4003,22 +4003,10 @@ menu_expire (KBNODE pub_keyblock)
   n1 = count_selected_keys (pub_keyblock);
   if (n1 > 1)
     {
-      char *s = xtryasprintf (_("Are you sure you want to change the"
-                                " expiration time %d subkeys? (y/N) "), n1);
-      int s_need_free;
-      if (s)
-        s_need_free = 0;
-      else
-        {
-          s = _("Are you sure you want to change the"
-                " expiration time for multiple subkeys? (y/N) ");
-          s_need_free = 0;
-        }
-
-      rc = cpr_get_answer_is_yes ("keyedit.expire_multiple_subkeys.okay", s);
-      if (s_need_free)
-        xfree (s);
-      if (! rc)
+      if (!cpr_get_answer_is_yes
+          ("keyedit.expire_multiple_subkeys.okay",
+           _("Are you sure you want to change the"
+             " expiration time for multiple subkeys? (y/N) ")))
 	return 0;
     }
   else if (n1)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list