--------------------- PatchSet 6855 Date: 2008/02/16 12:02:08 Author: amosjeffries Branch: cleanup Tag: (none) Log: Small performance boost in helper. - strlen() scans the entire buffer each time its used. dropping 2 scans, even in a helper is a Good Thing(tm) - Hopefully this will also get around a broken Coverity detection. Members: helpers/ntlm_auth/fakeauth/fakeauth_auth.c:1.9->1.9.10.1 Index: squid3/helpers/ntlm_auth/fakeauth/fakeauth_auth.c =================================================================== RCS file: /cvsroot/squid-sf//squid3/helpers/ntlm_auth/fakeauth/fakeauth_auth.c,v retrieving revision 1.9 retrieving revision 1.9.10.1 diff -u -r1.9 -r1.9.10.1 --- squid3/helpers/ntlm_auth/fakeauth/fakeauth_auth.c 19 Jul 2007 03:50:52 -0000 1.9 +++ squid3/helpers/ntlm_auth/fakeauth/fakeauth_auth.c 16 Feb 2008 12:02:08 -0000 1.9.10.1 @@ -369,6 +369,7 @@ main(int argc, char *argv[]) { char buf[BUFFER_SIZE]; + int buflen = 0; char user[256], *p, *decoded = NULL; struct ntlm_challenge chal; struct ntlm_negotiate *nego; @@ -390,9 +391,10 @@ if ((p = strchr(buf, '\n')) != NULL) *p = '\0'; /* strip \n */ - if (strlen(buf) > 3) + buflen = strlen(buf); /* keep this so we only scan the buffer for \0 once per loop */ + if (slen > 3) decoded = base64_decode(buf + 3); - if ((strlen(buf) > 3) && NTLM_packet_debug_enabled) { + if (buflen > 3 && NTLM_packet_debug_enabled) { strncpy(helper_command, buf, 2); helper_command[2] = '\0'; debug("Got '%s' from Squid with data:\n", helper_command); @@ -401,7 +403,7 @@ debug("Got '%s' from Squid\n", buf); if (strncasecmp(buf, "YR", 2) == 0) { - if (strlen(buf) > 3) { + if(buflen > 3) { nego = (struct ntlm_negotiate *) decoded; ntlmMakeChallenge(&chal, nego->flags); } else