0100,0100,0100 While trying to find who the hell mallocs sizes of <<4 bytes at a rate of 30-60/sec, and found problem with xmalloc_stats in util.c, I also found that access_log.c calls needless xcalloc for "-" when username is NULL.0100,0100,0100 pls consider for HEAD. ------- Forwarded message follows ------- Modified Files: Tag: akroonmaa-head access_log.c Log Message: avoid needless malloc/free of 2 byte string Index: access_log.c =================================================================== RCS file: /cvsroot/squid/squid/src/access_log.c,v retrieving revision 1.10 retrieving revision 1.10.24.1 diff -w -u -r1.10 -r1.10.24.1 --- access_log.c 2001/02/07 19:11:47 1.10 +++ access_log.c 2001/04/10 11:59:31 1.10.24.1 @@ -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, ------------------------------------ Andres Kroonmaa CTO, Delfi Online Tel: 6501 731, Fax: 6501 708 Pärnu mnt. 158, Tallinn, 11317 Estonia