[Pkg-gnupg-commit] [gnupg2] 10/185: agent: Add const qualifier for read-only table.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Aug 7 11:55:15 UTC 2017


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

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 509e4a4d7491daf496b21e5892f4f63ab90e8e21
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Tue May 23 06:42:44 2017 +0900

    agent: Add const qualifier for read-only table.
    
    * agent/call-pinentry.c (start_pinentry): Add const to tbl.
    * agent/command-ssh.c (request_specs): Add const.
    (ssh_key_types): Likewise.
    (request_spec_lookup): Add const to the return value and SPEC.
    (ssh_request_process): Likewise.
    * agent/protect.c (protect_info): Add const.
    (agent_unprotect): Add const to algotable.
    
    --
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
---
 agent/call-pinentry.c |  2 +-
 agent/command-ssh.c   | 10 +++++-----
 agent/gpg-agent.c     |  2 +-
 agent/protect.c       |  4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 1ff4059..9d8e7f6 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -489,7 +489,7 @@ start_pinentry (ctrl_t ctrl)
   {
     /* Provide a few default strings for use by the pinentries.  This
        may help a pinentry to avoid implementing localization code.  */
-    static struct { const char *key, *value; int what; } tbl[] = {
+    static const struct { const char *key, *value; int what; } tbl[] = {
       /* TRANSLATORS: These are labels for buttons etc used in
          Pinentries.  An underscore indicates that the next letter
          should be used as an accelerator.  Double the underscore for
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 57e2e42..99c80c0 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -262,7 +262,7 @@ static gpg_error_t ssh_key_extract_comment (gcry_sexp_t key, char **comment);
 /* Associating request types with the corresponding request
    handlers.  */
 
-static ssh_request_spec_t request_specs[] =
+static const ssh_request_spec_t request_specs[] =
   {
 #define REQUEST_SPEC_DEFINE(id, name, secret_input) \
   { SSH_REQUEST_##id, ssh_handler_##name, #name, secret_input }
@@ -280,7 +280,7 @@ static ssh_request_spec_t request_specs[] =
 
 
 /* Table holding key type specifications.  */
-static ssh_key_type_spec_t ssh_key_types[] =
+static const ssh_key_type_spec_t ssh_key_types[] =
   {
     {
       "ssh-ed25519", "Ed25519", GCRY_PK_EDDSA, "qd",  "q", "rs", "qd",
@@ -3376,10 +3376,10 @@ ssh_handler_unlock (ctrl_t ctrl, estream_t request, estream_t response)
 /* Return the request specification for the request identified by TYPE
    or NULL in case the requested request specification could not be
    found.  */
-static ssh_request_spec_t *
+static const ssh_request_spec_t *
 request_spec_lookup (int type)
 {
-  ssh_request_spec_t *spec;
+  const ssh_request_spec_t *spec;
   unsigned int i;
 
   for (i = 0; i < DIM (request_specs); i++)
@@ -3403,7 +3403,7 @@ request_spec_lookup (int type)
 static int
 ssh_request_process (ctrl_t ctrl, estream_t stream_sock)
 {
-  ssh_request_spec_t *spec;
+  const ssh_request_spec_t *spec;
   estream_t response = NULL;
   estream_t request = NULL;
   unsigned char request_type;
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index c764be8..6ec9b67 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -1911,7 +1911,7 @@ agent_copy_startup_env (ctrl_t ctrl)
   const char *value;
 
   for (idx=0; !err && names[idx]; idx++)
-      if ((value = session_env_getenv (opt.startup_env, names[idx])))
+    if ((value = session_env_getenv (opt.startup_env, names[idx])))
       err = session_env_setenv (ctrl->session_env, names[idx], value);
 
   if (!err && !ctrl->lc_ctype && opt.startup_lc_ctype)
diff --git a/agent/protect.c b/agent/protect.c
index a9de732..66c3741 100644
--- a/agent/protect.c
+++ b/agent/protect.c
@@ -54,7 +54,7 @@
 
 /* A table containing the information needed to create a protected
    private key.  */
-static struct {
+static const struct {
   const char *algo;
   const char *parmlist;
   int prot_from, prot_to;
@@ -1010,7 +1010,7 @@ agent_unprotect (ctrl_t ctrl,
                  gnupg_isotime_t protected_at,
                  unsigned char **result, size_t *resultlen)
 {
-  static struct {
+  static const struct {
     const char *name; /* Name of the protection method. */
     int algo;         /* (A zero indicates the "openpgp-native" hack.)  */
     int keylen;       /* Used key length in bytes.  */

-- 
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