From: Amos Jeffries Date: Mon, 19 Oct 2020 01:25:50 +0000 (+0000) Subject: Bug 5073: Compile error: index was not declared in this scope (#740) X-Git-Tag: SQUID_4_14~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8a34fb466e95ae158b696a8ec80b2694c2e1a6a;p=thirdparty%2Fsquid.git Bug 5073: Compile error: index was not declared in this scope (#740) 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. --- diff --git a/compat/os/mswindows.h b/compat/os/mswindows.h index e7f40f41c3..56a4126790 100644 --- a/compat/os/mswindows.h +++ b/compat/os/mswindows.h @@ -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 definitions are required before std API redefinitions. #include diff --git a/src/esi/VarState.cc b/src/esi/VarState.cc index 25807b8a9a..0cd399e23f 100644 --- a/src/esi/VarState.cc +++ b/src/esi/VarState.cc @@ -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);