]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Trivial optimization of string testing
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 20 Jan 2010 13:34:41 +0000 (13:34 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 20 Jan 2010 13:34:41 +0000 (13:34 +0000)
useragent.c

index a4aea011fdb53b4295f582ead152954d77dd145f..b438b80b86c8b4b6934fb213b4822e5d3fdeebac 100644 (file)
@@ -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);