viced: Unused sentinel in h_stateVerifyUuuidHash
authorSimon Wilkinson <sxw@your-file-system.com>
Sun, 24 Feb 2013 12:36:02 +0000 (12:36 +0000)
committerDerrick Brashear <shadow@your-file-system.com>
Mon, 25 Feb 2013 17:59:45 +0000 (09:59 -0800)
The 'found' sentinel in h_stateVerifyUuidHash is unused, because
as soon as we set it, we jump out to the 'done' label. Simplify the
function's logic, and remove a static analysis warning, by just
removing the variable.

Caught by clang-analyzer

Change-Id: I02e5ccf857f5d84cd24975b7a1b9d516624ecd64
Reviewed-on: http://gerrit.openafs.org/9250
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/viced/host.c

index 9e31e11..d8165d7 100644 (file)
@@ -3162,7 +3162,7 @@ h_stateVerifyAddrHash(struct fs_dump_state * state, struct host * h,
 static int
 h_stateVerifyUuidHash(struct fs_dump_state * state, struct host * h)
 {
-    int ret = 0, found = 0;
+    int ret = 0;
     struct host *host = NULL;
     struct h_UuidHashChain *chain;
     afsUUID * uuidp = &h->interface->uuid;
@@ -3185,7 +3185,6 @@ h_stateVerifyUuidHash(struct fs_dump_state * state, struct host * h)
                            h->index, host->index));
                state->flags.warnings_generated = 1;
            }
-           found = 1;
            goto done;
        }
        if (chain_len > FS_STATE_H_MAX_UUID_HASH_CHAIN_LEN) {
@@ -3197,16 +3196,16 @@ h_stateVerifyUuidHash(struct fs_dump_state * state, struct host * h)
        chain_len++;
     }
 
-    if (!found) {
-       afsUUID_to_string(uuidp, tmp, sizeof(tmp));
-       if (state->mode == FS_STATE_LOAD_MODE) {
-           ViceLog(0, ("h_stateVerifyUuidHash: error: uuid %s not found in hash\n", tmp));
-           ret = 1;
-           goto done;
-       } else {
-           ViceLog(0, ("h_stateVerifyUuidHash: warning: uuid %s not found in hash\n", tmp));
-           state->flags.warnings_generated = 1;
-       }
+    /* Fall through, so host not found */
+
+    afsUUID_to_string(uuidp, tmp, sizeof(tmp));
+    if (state->mode == FS_STATE_LOAD_MODE) {
+       ViceLog(0, ("h_stateVerifyUuidHash: error: uuid %s not found in hash\n", tmp));
+       ret = 1;
+       goto done;
+    } else {
+       ViceLog(0, ("h_stateVerifyUuidHash: warning: uuid %s not found in hash\n", tmp));
+       state->flags.warnings_generated = 1;
     }
 
  done: