--------------------- PatchSet 1869 Date: 2001/04/10 11:59:31 Author: akroonmaa Branch: akroonmaa-head Tag: (none) Log: avoid needless malloc/free of 2 byte string Members: src/access_log.c:1.10->1.10.24.1 Index: squid/src/access_log.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/access_log.c,v retrieving revision 1.10 retrieving revision 1.10.24.1 diff -u -r1.10 -r1.10.24.1 --- squid/src/access_log.c 7 Feb 2001 19:11:47 -0000 1.10 +++ squid/src/access_log.c 10 Apr 2001 11:59:31 -0000 1.10.24.1 @@ -1,6 +1,6 @@ /* - * $Id: access_log.c,v 1.10 2001/02/07 19:11:47 hno Exp $ + * $Id: access_log.c,v 1.10.24.1 2001/04/10 11:59:31 akroonmaa Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -227,7 +227,7 @@ accessLogFormatName(const char *name) { if (NULL == name) - return xcalloc(strlen(dash_str) + 1, 1); + return NULL; return username_quote(name); } @@ -240,6 +240,8 @@ 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 @@ 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 @@ 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,