From: hno <> Date: Tue, 10 Apr 2001 23:01:35 +0000 (+0000) Subject: From Andres Kroonmaa: X-Git-Tag: SQUID_3_0_PRE1~1548 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=04fa5a1f91217b3f49efe536e1d8c0b9ffe0eb72;p=thirdparty%2Fsquid.git From Andres Kroonmaa: avoid needless malloc/free of 2 byte string --- diff --git a/src/access_log.cc b/src/access_log.cc index e30cc9f556..e007002b60 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.67 2001/02/07 18:56:51 hno Exp $ + * $Id: access_log.cc,v 1.68 2001/04/10 17:01:35 hno Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -227,7 +227,7 @@ static char * accessLogFormatName(const char *name) { if (NULL == name) - return xcalloc(strlen(dash_str) + 1, 1); + return NULL; return username_quote(name); } @@ -240,6 +240,8 @@ accessLogSquid(AccessLogEntry * al) client = fqdncache_gethostbyaddr(al->cache.caddr, FQDN_LOOKUP_IF_MISS); if (client == NULL) client = inet_ntoa(al->cache.caddr); + user = accessLogFormatName(al->cache.authuser ? + al->cache.authuser : al->cache.rfc931); logfilePrintf(logfile, "%9d.%03d %6d %s %s/%03d %d %s %s %s %s%s/%s %s", (int) current_time.tv_sec, (int) current_time.tv_usec / 1000, @@ -250,8 +252,7 @@ accessLogSquid(AccessLogEntry * al) al->cache.size, al->private.method_str, al->url, - (user = accessLogFormatName(al->cache.authuser ? - al->cache.authuser : al->cache.rfc931)), + user ? user : dash_str, al->hier.ping.timedout ? "TIMEOUT_" : "", hier_strings[al->hier.code], al->hier.host, @@ -268,10 +269,11 @@ accessLogCommon(AccessLogEntry * al) client = fqdncache_gethostbyaddr(al->cache.caddr, 0); if (client == NULL) client = inet_ntoa(al->cache.caddr); + user = accessLogFormatName(al->cache.authuser); logfilePrintf(logfile, "%s %s %s [%s] \"%s %s HTTP/%d.%d\" %d %d %s:%s", client, accessLogFormatName(al->cache.rfc931), - (user = accessLogFormatName(al->cache.authuser)), + user ? user : dash_str, mkhttpdlogtime(&squid_curtime), al->private.method_str, al->url,