dgaudet     97/12/30 10:59:33

  Modified:    src      Tag: APACHE_1_2_X CHANGES util.c
  Log:
  Fix the O(n^2) behaviour of no2slash()
  
  Reviewed by:  Marc Slemko, Brian Behlendorf
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.286.2.60 +3 -0      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.286.2.59
  retrieving revision 1.286.2.60
  diff -u -r1.286.2.59 -r1.286.2.60
  --- CHANGES   1997/11/05 11:46:20     1.286.2.59
  +++ CHANGES   1997/12/30 18:59:30     1.286.2.60
  @@ -1,5 +1,8 @@
   Changes with Apache 1.2.5
   
  +  *) no2slash() was O(n^2) in the length of the input.  Make it O(n).
  +     [Dean Gaudet]
  +
     *) mod_include used uninitialized data for some uses of && and ||.
        [Brian Slesinsky <[EMAIL PROTECTED]>] PR#1139
   
  
  
  
  1.52.2.3  +15 -7     apache/src/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/util.c,v
  retrieving revision 1.52.2.2
  retrieving revision 1.52.2.3
  diff -u -r1.52.2.2 -r1.52.2.3
  --- util.c    1997/06/27 01:47:47     1.52.2.2
  +++ util.c    1997/12/30 18:59:32     1.52.2.3
  @@ -328,14 +328,22 @@
       }
   } 
   
  -void no2slash(char *name) {
  -    register int x,y;
  +void no2slash(char *name)
  +{
  +    char *d, *s;
   
  -    for(x=0; name[x];)
  -        if(x && (name[x-1] == '/') && (name[x] == '/'))
  -            for(y=x+1;name[y-1];y++)
  -                name[y-1] = name[y];
  -     else x++;
  +    s = d = name;
  +    while (*s) {
  +        if ((*d++ = *s) == '/') {
  +            do {
  +                ++s;
  +            } while (*s == '/');
  +        }
  +        else {
  +            ++s;
  +        }
  +    }
  +    *d = '\0';
   }
   
   char *make_dirstr(pool *p, const char *s, int n) {
  
  
  

Reply via email to