Use more descriptive names for global identifiers. DRY. sync
authorNeal H. Walfield <neal@pep.foundation>
Thu, 16 May 2019 09:21:14 +0200
branchsync
changeset 3703b8ff8becff09
parent 3702 2205ed308447
child 3704 ce00fd902b41
child 3705 471c0ce30f46
Use more descriptive names for global identifiers. DRY.

- Don't repeat yourself.

- Don't repeat yourself.
src/pgp_sequoia.c
     1.1 --- a/src/pgp_sequoia.c	Thu May 16 09:15:11 2019 +0200
     1.2 +++ b/src/pgp_sequoia.c	Thu May 16 09:21:14 2019 +0200
     1.3 @@ -176,10 +176,10 @@
     1.4  
     1.5  PEP_STATUS pgp_init(PEP_SESSION session, bool in_first)
     1.6  {
     1.7 -    #define PATH "/.pEp_keys.db"
     1.8 - 
     1.9      PEP_STATUS status = PEP_STATUS_OK;
    1.10  
    1.11 +#define PEP_KEYS_PATH "/.pEp_keys.db"
    1.12 +
    1.13      // Create the home directory.
    1.14      char *home_env = NULL;
    1.15  #ifndef NDEBUG
    1.16 @@ -191,13 +191,13 @@
    1.17          ERROR_OUT(NULL, PEP_INIT_GPGME_INIT_FAILED, "HOME unset");
    1.18  
    1.19      // Create the DB and initialize it.
    1.20 -    size_t path_size = strlen(home_env) + sizeof(PATH);
    1.21 +    size_t path_size = strlen(home_env) + sizeof(PEP_KEYS_PATH);
    1.22      char *path = (char *) calloc(1, path_size);
    1.23      assert(path);
    1.24      if (!path)
    1.25          ERROR_OUT(NULL, PEP_OUT_OF_MEMORY, "out of memory");
    1.26  
    1.27 -    int r = snprintf(path, path_size, "%s/.pEp_keys.db", home_env);
    1.28 +    int r = snprintf(path, path_size, "%s" PEP_KEYS_PATH, home_env);
    1.29      assert(r >= 0 && r < path_size);
    1.30      if (r < 0)
    1.31          ERROR_OUT(NULL, PEP_UNKNOWN_ERROR, "snprintf");