From 02105a8a9de680b3d19000c499c37ec352476bb7 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Tue, 16 Oct 2012 18:39:25 -0600 Subject: [PATCH] Static Code Analysis: varargs cleanup, improvements to readability --- src/cache_cf.cc | 2 +- src/ftp.cc | 1 + src/snmp_core.cc | 2 ++ src/stmem.cc | 3 +-- src/url.cc | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index bb37c0799e..cdb45ca56e 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -3636,7 +3636,7 @@ parse_port_option(AnyP::PortCfg * s, char *token) if (t) { ++t; s->tcp_keepalive.timeout = atoi(t); - t = strchr(t, ','); + // t = strchr(t, ','); // not really needed, left in as documentation } #if USE_SSL } else if (strcasecmp(token, "sslBump") == 0) { diff --git a/src/ftp.cc b/src/ftp.cc index 0658a8f90c..e0c1d37ec8 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -3768,6 +3768,7 @@ FtpStateData::printfReplyBody(const char *fmt, ...) buf[0] = '\0'; vsnprintf(buf, 4096, fmt, args); writeReplyBody(buf, strlen(buf)); + va_end(args); } /** diff --git a/src/snmp_core.cc b/src/snmp_core.cc index d779b67326..691ac74299 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -1036,6 +1036,7 @@ snmpAddNode(oid * name, int len, oid_ParseFn * parsefunction, instance_Fn * inst } } + va_end(args); return (entry); } /* End of tree utility functions */ @@ -1059,6 +1060,7 @@ snmpCreateOid(int length,...) } } + va_end(args); return (new_oid); } diff --git a/src/stmem.cc b/src/stmem.cc index 716c3097fa..2708286f1c 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -105,8 +105,7 @@ int64_t mem_hdr::freeDataUpto(int64_t target_offset) { /* keep the last one to avoid change to other part of code */ - - SplayNode const * theStart = nodes.start(); + SplayNode const * theStart; while ((theStart = nodes.start())) { if (theStart == nodes.finish()) diff --git a/src/url.cc b/src/url.cc index 5e6e1c23b9..282fc5d73f 100644 --- a/src/url.cc +++ b/src/url.cc @@ -310,7 +310,8 @@ urlParse(const HttpRequestMethod& method, char *url, HttpRequest *request) port = urlDefaultPort(protocol); /* Is there any login information? (we should eventually parse it above) */ - if ((t = strrchr(host, '@'))) { + t = strrchr(host, '@'); + if (t != NULL) { strcpy((char *) login, (char *) host); t = strrchr(login, '@'); *t = 0; -- 2.47.2