]> granicus.if.org Git - apache/commitdiff
somebody was a Very Bad Boy when they inserted casts into this function.
authorGreg Stein <gstein@apache.org>
Thu, 19 Oct 2000 10:43:03 +0000 (10:43 +0000)
committerGreg Stein <gstein@apache.org>
Thu, 19 Oct 2000 10:43:03 +0000 (10:43 +0000)
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? :-)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86668 13f79535-47bb-0310-9956-ffa450edef68

include/httpd.h
server/util.c

index a1c6ffc37e254648f3e321f6c8f04c006b22ab5e..7e0f64f0f9e53e052bc0fbeab0b0969f6a8176e9 100644 (file)
@@ -1396,9 +1396,10 @@ AP_DECLARE(char *) ap_strcasestr(const char *s1, const char *s2);
  * @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
index 6b23e715250fc1af5e2c2526ffa891fcb5223e5b..a3aab61b2d500c46a0816f7ac77c02c798ff3f6a 100644 (file)
@@ -342,21 +342,24 @@ AP_DECLARE(char *) ap_strcasestr(const char *s1, const char *s2)
  * 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;
 }
 
 /*