httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject cvs commit: httpd-2.0/server util.c
Date Mon, 12 Feb 2001 02:39:24 GMT
gstein      01/02/11 18:39:24

  Modified:    server   util.c
  Log:
  write these in terms of strchr and strrchr so the compiler can possibly use
  builtin, optimized functions.
  [ they're stupid functions, but what the hell ]
  
  Revision  Changes    Path
  1.102     +8 -12     httpd-2.0/server/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util.c,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -u -r1.101 -r1.102
  --- util.c	2001/02/11 00:51:38	1.101
  +++ util.c	2001/02/12 02:39:24	1.102
  @@ -1720,24 +1720,20 @@
   
   AP_DECLARE(int) ap_ind(const char *s, char c)
   {
  -    register int x;
  +    const char *p = ap_strchr_c(s, c);
   
  -    for (x = 0; s[x]; x++)
  -	if (s[x] == c)
  -	    return x;
  -
  -    return -1;
  +    if (p == NULL)
  +        return -1;
  +    return p - s;
   }
   
   AP_DECLARE(int) ap_rind(const char *s, char c)
   {
  -    register int x;
  -
  -    for (x = strlen(s) - 1; x != -1; x--)
  -	if (s[x] == c)
  -	    return x;
  +    const char *p = ap_strrchr_c(s, c);
   
  -    return -1;
  +    if (p == NULL)
  +        return -1;
  +    return p - s;
   }
   
   AP_DECLARE(void) ap_str_tolower(char *str)
  
  
  

Mime
View raw message