From: Simon Wilkinson Date: Sun, 24 Feb 2013 12:36:02 +0000 (+0000) Subject: viced: Unused sentinel in h_stateVerifyUuuidHash X-Git-Tag: openafs-stable-1_8_0pre1~1430 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=d09b300a96691b4848760fde02b4d0e741bc2584 viced: Unused sentinel in h_stateVerifyUuuidHash 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 Reviewed-by: Derrick Brashear Tested-by: BuildBot --- diff --git a/src/viced/host.c b/src/viced/host.c index 9e31e11..d8165d7 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -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: