From d09b300a96691b4848760fde02b4d0e741bc2584 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sun, 24 Feb 2013 12:36:02 +0000 Subject: [PATCH] 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 --- src/viced/host.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/viced/host.c b/src/viced/host.c index 9e31e1156..d8165d79d 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: -- 2.39.5