httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@locus.apache.org
Subject cvs commit: apache-2.0/src/main util.c
Date Thu, 19 Oct 2000 10:43:04 GMT
gstein      00/10/19 03:43:04

  Modified:    src/include httpd.h
               src/main util.c
  Log:
  somebody was a Very Bad Boy when they inserted casts into this function.
  casting away the const was absolutely wrong... the warnings were saying the
  return value type needed to be fixed. did that and torched the casts.
  
  who still thinks casts are a good idea? :-)
  
  Revision  Changes    Path
  1.107     +3 -2      apache-2.0/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/httpd.h,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- httpd.h	2000/10/18 19:12:06	1.106
  +++ httpd.h	2000/10/19 10:43:03	1.107
  @@ -1396,9 +1396,10 @@
    * @param bigstring The input string
    * @param prefix The prefix to strip away
    * @return A pointer relative to bigstring after prefix
  - * deffunc char *ap_stripprefix(const char *bigstring, const char *prefix);
  + * deffunc const char *ap_stripprefix(const char *bigstring, const char *prefix);
    */
  -AP_DECLARE(char *) ap_stripprefix(const char *bigstring, const char *prefix);
  +AP_DECLARE(const char *) ap_stripprefix(const char *bigstring,
  +                                        const char *prefix);
   
   /**
    * Decode a base64 encoded string into memory allocated out of a pool
  
  
  
  1.75      +14 -11    apache-2.0/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util.c,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- util.c	2000/10/18 15:58:29	1.74
  +++ util.c	2000/10/19 10:43:03	1.75
  @@ -342,21 +342,24 @@
    * can use standard pointer comparisons in the calling function
    * (eg: test if ap_stripprefix(a,b) == a)
    */
  -AP_DECLARE(char *) ap_stripprefix(const char *bigstring, const char *prefix)
  +AP_DECLARE(const char *) ap_stripprefix(const char *bigstring,
  +                                        const char *prefix)
   {
  -    char *p1;
  -    if (*prefix == '\0') {
  -        return( (char *)bigstring);
  -    }
  -    p1 = (char *)bigstring;
  -    while(*p1 && *prefix) {
  +    const char *p1;
  +
  +    if (*prefix == '\0')
  +        return bigstring;
  +
  +    p1 = bigstring;
  +    while (*p1 && *prefix) {
           if (*p1++ != *prefix++)
  -            return( (char *)bigstring);
  +            return bigstring;
       }
       if (*prefix == '\0')
  -        return(p1);
  -    else /* hit the end of bigstring! */
  -        return( (char *)bigstring);
  +        return p1;
  +
  +    /* hit the end of bigstring! */
  +    return bigstring;
   }
   
   /* 
  
  
  

Mime
View raw message