tighter scope, more const
authorRoker <roker@pep-project.org>
Thu, 14 Jul 2016 11:32:56 +0200
changeset 8796460821c3170
parent 871 f0c1582416e3
child 880 c9c9de1e8e27
tighter scope, more const
(transplanted from 7bb8baa0d4eee3e4226d8cc1cc32f0c470f53064)
src/blacklist.c
src/pEpEngine.c
src/pgp_gpg.c
     1.1 --- a/src/blacklist.c	Thu Jul 14 10:13:08 2016 +0200
     1.2 +++ b/src/blacklist.c	Thu Jul 14 11:32:56 2016 +0200
     1.3 @@ -115,21 +115,21 @@
     1.4      sqlite3_reset(session->blacklist_retrieve);
     1.5  
     1.6      int result;
     1.7 -    const char *fpr = NULL;
     1.8  
     1.9      stringlist_t *_bl = _blacklist;
    1.10      do {
    1.11          result = sqlite3_step(session->blacklist_retrieve);
    1.12          switch (result) {
    1.13          case SQLITE_ROW:
    1.14 -            fpr = (const char *) sqlite3_column_text(session->blacklist_retrieve, 0);
    1.15 +        {
    1.16 +            const char *fpr = (const char *) sqlite3_column_text(session->blacklist_retrieve, 0);
    1.17  
    1.18              _bl = stringlist_add(_bl, fpr);
    1.19              if (_bl == NULL)
    1.20                  goto enomem;
    1.21  
    1.22              break;
    1.23 -
    1.24 +        }
    1.25          case SQLITE_DONE:
    1.26              break;
    1.27  
     2.1 --- a/src/pEpEngine.c	Thu Jul 14 10:13:08 2016 +0200
     2.2 +++ b/src/pEpEngine.c	Thu Jul 14 11:32:56 2016 +0200
     2.3 @@ -778,8 +778,6 @@
     2.4  {
     2.5      PEP_STATUS status = PEP_STATUS_OK;
     2.6      static pEp_identity *_identity;
     2.7 -    int result;
     2.8 -    const char *_lang;
     2.9  
    2.10      assert(session);
    2.11      assert(address);
    2.12 @@ -795,7 +793,7 @@
    2.13      sqlite3_bind_text(session->get_identity, 1, address, -1, SQLITE_STATIC);
    2.14      sqlite3_bind_text(session->get_identity, 2, user_id, -1, SQLITE_STATIC);
    2.15  
    2.16 -    result = sqlite3_step(session->get_identity);
    2.17 +    const int result = sqlite3_step(session->get_identity);
    2.18      switch (result) {
    2.19      case SQLITE_ROW:
    2.20          _identity = new_identity(
    2.21 @@ -809,7 +807,7 @@
    2.22              return PEP_OUT_OF_MEMORY;
    2.23  
    2.24          _identity->comm_type = (PEP_comm_type) sqlite3_column_int(session->get_identity, 2);
    2.25 -        _lang = (const char *) sqlite3_column_text(session->get_identity, 3);
    2.26 +        const char* const _lang = (const char *) sqlite3_column_text(session->get_identity, 3);
    2.27          if (_lang && _lang[0]) {
    2.28              assert(_lang[0] >= 'a' && _lang[0] <= 'z');
    2.29              assert(_lang[1] >= 'a' && _lang[1] <= 'z');
     3.1 --- a/src/pgp_gpg.c	Thu Jul 14 10:13:08 2016 +0200
     3.2 +++ b/src/pgp_gpg.c	Thu Jul 14 11:32:56 2016 +0200
     3.3 @@ -95,7 +95,6 @@
     3.4      PEP_STATUS status = PEP_STATUS_OK;
     3.5      gpgme_error_t gpgme_error;
     3.6      bool bResult;
     3.7 -    char *cLocal;
     3.8      
     3.9      if (in_first) {
    3.10          stringlist_t *conf_keys   = new_stringlist("keyserver");
    3.11 @@ -333,7 +332,7 @@
    3.12  
    3.13          gpg.version = gpg.gpgme_check(NULL);
    3.14          
    3.15 -        cLocal = setlocale(LC_ALL, NULL);
    3.16 +        const char * const cLocal = setlocale(LC_ALL, NULL);
    3.17          if (!cLocal || (strcmp(cLocal, "C") == 0))
    3.18              setlocale(LC_ALL, "");
    3.19