Repository: trafficserver Updated Branches: refs/heads/master abcc5f7c9 -> 4c13e1705
TS-1475: Dead store, clang analyzer. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/4c13e170 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/4c13e170 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/4c13e170 Branch: refs/heads/master Commit: 4c13e1705cfdda3444fdb1343e42896dd506b702 Parents: abcc5f7 Author: Phil Sorber <[email protected]> Authored: Wed Jul 16 11:53:37 2014 -0600 Committer: Phil Sorber <[email protected]> Committed: Wed Jul 16 11:53:37 2014 -0600 ---------------------------------------------------------------------- iocore/hostdb/HostDB.cc | 57 +++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4c13e170/iocore/hostdb/HostDB.cc ---------------------------------------------------------------------- diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index 4e76200..5d239ee 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -546,48 +546,45 @@ make_md5(INK_MD5 & md5, const char *hostname, int len, int port, char const* pDN } static bool -reply_to_cont(Continuation * cont, HostDBInfo * ar, bool is_srv = false) +reply_to_cont(Continuation * cont, HostDBInfo * r, bool is_srv = false) { - const char *reason = "none"; - HostDBInfo *r = ar; - if (r == NULL || r->is_srv != is_srv || r->failed()) { cont->handleEvent(is_srv ? EVENT_SRV_LOOKUP : EVENT_HOST_DB_LOOKUP, NULL); return false; } - { - if (r->reverse_dns) { - if (!r->hostname()) { - reason = "missing hostname"; - ink_assert(!"missing hostname"); - goto Lerror; - } - Debug("hostdb", "hostname = %s", r->hostname()); + if (r->reverse_dns) { + if (!r->hostname()) { + ink_assert(!"missing hostname"); + cont->handleEvent(is_srv ? EVENT_SRV_LOOKUP : EVENT_HOST_DB_LOOKUP, NULL); + Warning("bogus entry deleted from HostDB: missing hostname"); + hostDB.delete_block(r); + return false; } + Debug("hostdb", "hostname = %s", r->hostname()); + } - if (!r->is_srv && r->round_robin) { - if (!r->rr()) { - reason = "missing round-robin"; - ink_assert(!"missing round-robin"); - goto Lerror; - } - ip_text_buffer ipb; - Debug("hostdb", "RR of %d with %d good, 1st IP = %s", r->rr()->rrcount, r->rr()->good, ats_ip_ntop(r->ip(), ipb, sizeof ipb)); + if (!r->is_srv && r->round_robin) { + if (!r->rr()) { + ink_assert(!"missing round-robin"); + cont->handleEvent(is_srv ? EVENT_SRV_LOOKUP : EVENT_HOST_DB_LOOKUP, NULL); + Warning("bogus entry deleted from HostDB: missing round-robin"); + hostDB.delete_block(r); + return false; } + ip_text_buffer ipb; + Debug("hostdb", "RR of %d with %d good, 1st IP = %s", r->rr()->rrcount, r->rr()->good, ats_ip_ntop(r->ip(), ipb, sizeof ipb)); + } - cont->handleEvent(is_srv ? EVENT_SRV_LOOKUP : EVENT_HOST_DB_LOOKUP, r); + cont->handleEvent(is_srv ? EVENT_SRV_LOOKUP : EVENT_HOST_DB_LOOKUP, r); - if (!r->full) - goto Ldelete; - return true; + if (!r->full) { + Warning("bogus entry deleted from HostDB: none"); + hostDB.delete_block(r); + return false; } -Lerror: - cont->handleEvent(is_srv ? EVENT_SRV_LOOKUP : EVENT_HOST_DB_LOOKUP, NULL); -Ldelete: - Warning("bogus entry deleted from HostDB: %s", reason); - hostDB.delete_block(ar); - return false; + + return true; } inline HostResStyle
