]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 5073: Compile error: index was not declared in this scope (#740)
authorAmos Jeffries <yadij@users.noreply.github.com>
Mon, 19 Oct 2020 01:25:50 +0000 (01:25 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 21 Oct 2020 01:28:29 +0000 (01:28 +0000)
Use strchr(3) instead of a legacy POSIX.1-2001 index(3) API.

Also removed the index() implementation on MS Windows as no longer used.

compat/os/mswindows.h
src/esi/VarState.cc

index 008aa781e482488f8cc9841eac0654c3cdd43359..71c6676dee81f1af23cce14afe40e7b3e0b6a5f7 100644 (file)
@@ -498,12 +498,6 @@ write(int fd, const void * buf, size_t siz)
         return _write(fd, buf, siz);
 }
 
-inline char *
-index(const char *s, int c)
-{
-    return (char *)strchr(s,c);
-}
-
 // stdlib <functional> definitions are required before std API redefinitions.
 #include <functional>
 
index 8029c634ac2b717efbdaa49b2cfd09dc8e847019..f7f31db9fa43e366c52b21ef09d3e3b28779b2ee 100644 (file)
@@ -150,7 +150,7 @@ ESIVariableUserAgent::getProductVersion (char const *s)
 {
     char const *t;
     int len;
-    t = index(s,'/');
+    t = strchr(s, '/');
 
     if (!t || !*(++t))
         return xstrdup("");
@@ -328,12 +328,12 @@ ESIVariableUserAgent::ESIVariableUserAgent(ESIVarState &state)
 
         if ((t = strstr (s, "MSIE"))) {
             browser = ESI_BROWSER_MSIE;
-            t = index (t, ' ');
+            t = strchr(t, ' ');
 
             if (!t)
                 browserversion = xstrdup("");
             else {
-                t1 = index(t, ';');
+                t1 = strchr(t, ';');
 
                 if (!t1)
                     browserversion = xstrdup(t + 1);