From 8b17259223b625dd2df2aa2079192e99bfdb5e40 Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Sat, 24 Jun 2000 19:31:42 +0000 Subject: [PATCH] Fix a couple of const warnings on Linux. This basically just defines ap_strstr and ap_strstr_c, which make sure that things are const when they need to be. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85687 13f79535-47bb-0310-9956-ffa450edef68 --- include/httpd.h | 6 ++++++ modules/generators/mod_autoindex.c | 2 +- modules/http/http_protocol.c | 4 ++-- server/util_debug.c | 8 ++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/httpd.h b/include/httpd.h index fd7aa83f37..837eaf5bf2 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -1035,11 +1035,15 @@ API_EXPORT(extern const char *) ap_psignature(const char *prefix, request_rec *r # define strchr(s, c) ap_strchr(s,c) #undef strrchr # define strrchr(s, c) ap_strrchr(s,c) +#undef strstr +# define strstr(s, c) ap_strstr(s,c) char *ap_strchr(char *s, int c); const char *ap_strchr_c(const char *s, int c); char *ap_strrchr(char *s, int c); const char *ap_strrchr_c(const char *s, int c); +char *ap_strstr(char *s, char *c); +const char *ap_strstr_c(const char *s, const char *c); #else @@ -1047,6 +1051,8 @@ const char *ap_strrchr_c(const char *s, int c); # define ap_strchr_c(s, c) strchr(s, c) # define ap_strrchr(s, c) strrchr(s, c) # define ap_strrchr_c(s, c) strrchr(s, c) +# define ap_strstr(s, c) strstr(s, c) +# define ap_strstr_c(s, c) strstr(s, c) #endif diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 9442707fc0..5954c4b15f 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -818,7 +818,7 @@ static char *find_desc(autoindex_config_rec *dcfg, request_rec *r) found = (ap_fnmatch(tuple->pattern, filename, MATCH_FLAGS) == 0); } else { - found = (strstr(filename, tuple->pattern) != NULL); + found = (ap_strstr_c(filename, tuple->pattern) != NULL); } if (found) { return tuple->description; diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index c232323bad..6451510265 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -610,7 +610,7 @@ API_EXPORT(int) ap_meets_conditions(request_rec *r) return HTTP_NOT_MODIFIED; } } - else if (strstr(if_nonematch, etag)) { + else if (ap_strstr_c(if_nonematch, etag)) { return HTTP_NOT_MODIFIED; } } @@ -1631,7 +1631,7 @@ static int use_range_x(request_rec *r) const char *ua; return (ap_table_get(r->headers_in, "Request-Range") || ((ua = ap_table_get(r->headers_in, "User-Agent")) - && strstr(ua, "MSIE 3"))); + && ap_strstr_c(ua, "MSIE 3"))); } /* This routine is called by ap_table_do and merges all instances of diff --git a/server/util_debug.c b/server/util_debug.c index 415fdcac8e..0972832cfb 100644 --- a/server/util_debug.c +++ b/server/util_debug.c @@ -75,4 +75,12 @@ char *ap_strrchr(char *s, int c) const char *ap_strrchr_c(const char *s, int c) { return strrchr(s,c); } +#undef strstr + +char *ap_strstr(char *s, char *c) +{ return strstr(s,c); } + +const char *ap_strstr_c(const char *s, const char *c) +{ return strstr(s,c); } + #endif -- 2.50.1