From: Frédéric Marchal Date: Wed, 20 Jan 2010 13:34:41 +0000 (+0000) Subject: Trivial optimization of string testing X-Git-Tag: v2_2_7~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a4d2bda727596d4b46c5d706dda244dd9e06e82;p=thirdparty%2Fsarg.git Trivial optimization of string testing --- diff --git a/useragent.c b/useragent.c index a4aea01..b438b80 100644 --- a/useragent.c +++ b/useragent.c @@ -89,7 +89,7 @@ void useragent(void) if(strstr(warea,"SCRIPT") != 0 || strstr(warea,"ONLOAD") != 0) baddata(); - if(strlen(gwarea.current)) { + if(gwarea.current[0]!='\0') { if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword(user,sizeof(user),&gwarea,'\n')<0) { printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",UserAgentLog); exit(1); @@ -98,7 +98,7 @@ void useragent(void) if(user[0] == '-') strcpy(user,ip); - if(strlen(user) == 0) + if(user[0] == '\0') strcpy(user,ip); fprintf(fp_ou,"%s\t%s\t%s\n",ip,agent,user);