]> 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)
committerAmos Jeffries <yadij@users.noreply.github.com>
Sun, 31 Jan 2021 00:21:09 +0000 (13:21 +1300)
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 e7f40f41c39ea341f9dc2ea0a65486702f783d5b..56a41267903ef275807a335e7f941f16b397ed51 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 25807b8a9a321937cb492ab1ce6e15811b463aee..0cd399e23f77cd6bb9fb8605917b55d3f5857783 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);