This patch moves the following functions to apr_strings
it also #defines the old names in httpd.h for backwards
compatibility (which is intended to be removed in a month or so)
ap_ind --> apr_ind
ap_rind --> apr_rind
ap_str_tolower --> apr_str_tolower
ap_strchr_c --> apr_strchr_c
ap_strchr --> apr_strchr
ap_strrchr --> apr_strrchr
ap_strrchr_c --> apr_strrchr_c
ap_strstr --> apr_strstr
ap_strstr_c --> apr_strstr_c
there are 2 patch files
1 is for APR/httpd
the other for mod_proxy
..Ian
Index: mod_proxy.c
===================================================================
RCS file: /home/cvspublic/httpd-proxy/module-2.0/mod_proxy.c,v
retrieving revision 1.44
diff -u -r1.44 mod_proxy.c
--- mod_proxy.c 2001/04/15 18:16:22 1.44
+++ mod_proxy.c 2001/05/30 04:14:17
@@ -357,7 +357,7 @@
/* firstly, try a proxy, unless a NoProxy directive is active */
if (!direct_connect) {
for (i = 0; i < proxies->nelts; i++) {
- p2 = ap_strchr_c(ents[i].scheme, ':'); /* is it a partial URL? */
+ p2 = apr_strchr_c(ents[i].scheme, ':'); /* is it a partial URL? */
if (strcmp(ents[i].scheme, "*") == 0 ||
(p2 == NULL && strcasecmp(scheme, ents[i].scheme) == 0) ||
(p2 != NULL &&
@@ -474,8 +474,8 @@
port = -1;
*p = '\0';
if (strchr(f, ':') == NULL)
- ap_str_tolower(f); /* lowercase scheme */
- ap_str_tolower(p + 3); /* lowercase hostname */
+ apr_str_tolower(f); /* lowercase scheme */
+ apr_str_tolower(p + 3); /* lowercase hostname */
if (port == -1) {
port = ap_default_port_for_scheme(scheme);
@@ -603,14 +603,14 @@
#endif
}
else if (ap_proxy_is_domainname(New, parms->pool)) {
- ap_str_tolower(New->name);
+ apr_str_tolower(New->name);
#if DEBUGGING
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
"Parsed domain %s", New->name);
#endif
}
else if (ap_proxy_is_hostname(New, parms->pool)) {
- ap_str_tolower(New->name);
+ apr_str_tolower(New->name);
#if DEBUGGING
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
"Parsed host %s", New->name);
Index: proxy_util.c
===================================================================
RCS file: /home/cvspublic/httpd-proxy/module-2.0/proxy_util.c,v
retrieving revision 1.60
diff -u -r1.60 proxy_util.c
--- proxy_util.c 2001/05/11 17:32:41 1.60
+++ proxy_util.c 2001/05/30 04:14:22
@@ -269,7 +269,7 @@
return "Port number in URL > 65535";
}
}
- ap_str_tolower(host); /* DNS names are case-insensitive */
+ apr_str_tolower(host); /* DNS names are case-insensitive */
if (*host == '\0')
return "Missing host in URL";
/* check hostname syntax */
@@ -472,7 +472,7 @@
len = strlen(val);
while (list != NULL) {
- p = ap_strchr_c(list, ',');
+ p = apr_strchr_c(list, ',');
if (p != NULL) {
i = p - list;
do
@@ -506,7 +506,7 @@
len = strlen(val);
while (list != NULL) {
- p = ap_strchr_c(list, ',');
+ p = apr_strchr_c(list, ',');
if (p != NULL) {
i = p - list;
do
@@ -1031,7 +1031,7 @@
static int proxy_match_word(struct dirconn_entry *This, request_rec *r)
{
const char *host = proxy_get_host_of_request(r);
- return host != NULL && ap_strstr_c(host, This->name) != NULL;
+ return host != NULL && apr_strstr_c(host, This->name) != NULL;
}
/* checks whether a host in uri_addr matches proxyblock */
@@ -1045,7 +1045,7 @@
struct apr_sockaddr_t *conf_addr = npent[j].addr;
ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
"proxy: checking remote machine [%s] against [%s]",
uri_addr->hostname, npent[j].name);
- if ((npent[j].name && ap_strstr_c(uri_addr->hostname, npent[j].name))
+ if ((npent[j].name && apr_strstr_c(uri_addr->hostname, npent[j].name))
|| npent[j].name[0] == '*') {
ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, r->server,
"proxy: connect to remote machine %s blocked: name %s
matched", uri_addr->hostname, npent[j].name);
Index: include/httpd.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/include/httpd.h,v
retrieving revision 1.151
diff -u -r1.151 httpd.h
--- include/httpd.h 2001/05/22 01:31:02 1.151
+++ include/httpd.h 2001/05/30 04:00:48
@@ -1390,30 +1390,6 @@
AP_DECLARE(void) ap_content_type_tolower(char *s);
/**
- * convert a string to all lowercase
- * @param s The string to convert to lowercase
- */
-AP_DECLARE(void) ap_str_tolower(char *s);
-
-/**
- * Search a string from left to right for the first occurrence of a
- * specific character
- * @param str The string to search
- * @param c The character to search for
- * @return The index of the first occurrence of c in str
- */
-AP_DECLARE(int) ap_ind(const char *str, char c); /* Sigh... */
-
-/**
- * Search a string from right to left for the first occurrence of a
- * specific character
- * @param str The string to search
- * @param c The character to search for
- * @return The index of the first occurrence of c in str
- */
-AP_DECLARE(int) ap_rind(const char *str, char c);
-
-/**
* Given a string, replace any bare " with \" .
* @param p The pool to allocate memory from
* @param instring The string to search for "
@@ -1501,6 +1477,25 @@
#endif
#define strtoul strtoul_is_not_a_portable_function_use_strtol_instead
+/* the following are for compatibility.
+ * These will be removed once changes are commited in APR, and
+ * all affected modules are determined
+ * TODO: REMOVE BY 2001-06-15
+ */
+
+#define ap_str_tolower(x) apr_str_tolower(x)
+#define ap_ind(x,y) apr_ind(x,y)
+#define ap_rind(x,y) apr_rind(x,y)
+#define ap_strchr(s, c) strchr(s, 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)
+/*
+ * TODO: REMOVE ABOVE BY 2001-06-15
+ */
+#endif
/* The C library has functions that allow const to be silently dropped ...
these macros detect the drop in maintainer mode, but use the native
methods for normal builds
@@ -1508,34 +1503,9 @@
Note that on some platforms (e.g., AIX with gcc, Solaris with gcc),
string.h needs
to be included before the macros are defined or compilation will fail.
*/
-#include <string.h>
-
-#ifdef AP_DEBUG
-#undef strchr
-# 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
-
-# define ap_strchr(s, c) strchr(s, 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
+#include <string.h>
#ifdef __cplusplus
}
Index: modules/dav/main/mod_dav.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/dav/main/mod_dav.c,v
retrieving revision 1.56
diff -u -r1.56 mod_dav.c
--- modules/dav/main/mod_dav.c 2001/04/17 11:07:02 1.56
+++ modules/dav/main/mod_dav.c 2001/05/30 04:01:01
@@ -394,7 +394,7 @@
const char *e_uri = ap_escape_uri(p, uri);
/* check the easy case... */
- if (ap_strchr_c(e_uri, '&') == NULL)
+ if (apr_strchr_c(e_uri, '&') == NULL)
return e_uri;
/* there was a '&', so more work is needed... sigh. */
@@ -696,8 +696,8 @@
range = apr_pstrdup(r->pool, range_c);
if (strncasecmp(range, "bytes ", 6) != 0
- || (dash = ap_strchr(range, '-')) == NULL
- || (slash = ap_strchr(range, '/')) == NULL) {
+ || (dash = apr_strchr(range, '-')) == NULL
+ || (slash = apr_strchr(range, '/')) == NULL) {
/* malformed header. ignore it (per S14.16 of RFC2616) */
return 0;
}
Index: modules/generators/mod_autoindex.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/generators/mod_autoindex.c,v
retrieving revision 1.63
diff -u -r1.63 mod_autoindex.c
--- modules/generators/mod_autoindex.c 2001/02/28 15:24:05 1.63
+++ modules/generators/mod_autoindex.c 2001/05/30 04:01:12
@@ -248,7 +248,7 @@
}
if (cmd->info == BY_ENCODING) {
char *tmp = apr_pstrdup(cmd->pool, to);
- ap_str_tolower(tmp);
+ apr_str_tolower(tmp);
to = tmp;
}
@@ -280,7 +280,7 @@
}
if (cmd->info == BY_ENCODING) {
char *tmp = apr_pstrdup(cmd->pool, to);
- ap_str_tolower(tmp);
+ apr_str_tolower(tmp);
to = tmp;
}
@@ -319,7 +319,7 @@
char *prefix = "";
desc_entry = (ai_desc_t *) apr_array_push(dcfg->desc_list);
- desc_entry->full_path = (ap_strchr_c(to, '/') == NULL) ? 0 : 1;
+ desc_entry->full_path = (apr_strchr_c(to, '/') == NULL) ? 0 : 1;
desc_entry->wildcards = (WILDCARDS_REQUIRED
|| desc_entry->full_path
|| apr_is_fnmatch(to));
@@ -802,7 +802,7 @@
* If the filename includes a path, extract just the name itself
* for the simple matches.
*/
- if ((filename_only = ap_strrchr_c(filename_full, '/')) == NULL) {
+ if ((filename_only = apr_strrchr_c(filename_full, '/')) == NULL) {
filename_only = filename_full;
}
else {
@@ -824,7 +824,7 @@
found = (apr_fnmatch(tuple->pattern, filename, MATCH_FLAGS) == 0);
}
else {
- found = (ap_strstr_c(filename, tuple->pattern) != NULL);
+ found = (apr_strstr_c(filename, tuple->pattern) != NULL);
}
if (found) {
return tuple->description;
@@ -1132,7 +1132,7 @@
for (x = 0, p = 0; titlebuf[x]; x++) {
if (apr_toupper(titlebuf[x]) == find[p]) {
if (!find[++p]) {
- if ((p = ap_ind(&titlebuf[++x], '<')) != -1) {
+ if ((p = apr_ind(&titlebuf[++x], '<')) != -1) {
titlebuf[x + p] = '\0';
}
/* Scan for line breaks for Tanmoy's secretary */
Index: modules/generators/mod_cgi.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/generators/mod_cgi.c,v
retrieving revision 1.92
diff -u -r1.92 mod_cgi.c
--- modules/generators/mod_cgi.c 2001/02/28 15:24:05 1.92
+++ modules/generators/mod_cgi.c 2001/05/30 04:01:14
@@ -480,7 +480,7 @@
char *w;
const char *args = r->args;
- if (!args || !args[0] || ap_strchr_c(args, '=')) {
+ if (!args || !args[0] || apr_strchr_c(args, '=')) {
numwords = 1;
}
else {
Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.321
diff -u -r1.321 http_protocol.c
--- modules/http/http_protocol.c 2001/05/17 18:04:18 1.321
+++ modules/http/http_protocol.c 2001/05/30 04:01:20
@@ -268,7 +268,7 @@
return HTTP_NOT_MODIFIED;
}
}
- else if (ap_strstr_c(if_nonematch, etag)) {
+ else if (apr_strstr_c(if_nonematch, etag)) {
return HTTP_NOT_MODIFIED;
}
}
@@ -2232,7 +2232,7 @@
const char *ua;
return (apr_table_get(r->headers_in, "Request-Range") ||
((ua = apr_table_get(r->headers_in, "User-Agent"))
- && ap_strstr_c(ua, "MSIE 3")));
+ && apr_strstr_c(ua, "MSIE 3")));
}
#define BYTERANGE_FMT "%" APR_OFF_T_FMT "-%" APR_OFF_T_FMT "/%" APR_OFF_T_FMT
@@ -2452,7 +2452,7 @@
/* would be nice to pick this up from f->ctx */
ct = ap_make_content_type(r, r->content_type);
- if (!ap_strchr_c(range, ',')) {
+ if (!apr_strchr_c(range, ',')) {
int rv;
/* A single range */
Index: modules/http/mod_mime.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/mod_mime.c,v
retrieving revision 1.41
diff -u -r1.41 mod_mime.c
--- modules/http/mod_mime.c 2001/03/16 07:28:06 1.41
+++ modules/http/mod_mime.c 2001/05/30 04:01:22
@@ -207,7 +207,7 @@
if (*ext == '.')
++ext;
- ap_str_tolower(ct);
+ apr_str_tolower(ct);
apr_table_setn(m->forced_types, ext, ct);
return NULL;
}
@@ -220,7 +220,7 @@
if (*ext == '.')
++ext;
- ap_str_tolower(enc);
+ apr_str_tolower(enc);
apr_table_setn(m->encoding_types, ext, enc);
return NULL;
}
@@ -234,7 +234,7 @@
if (*ext == '.') {
++ext;
}
- ap_str_tolower(charset);
+ apr_str_tolower(charset);
apr_table_setn(m->charset_types, ext, charset);
return NULL;
}
@@ -248,7 +248,7 @@
if (*ext == '.') {
++ext;
}
- ap_str_tolower(lang);
+ apr_str_tolower(lang);
apr_table_setn(m->language_types, ext, lang);
return NULL;
}
@@ -261,7 +261,7 @@
if (*ext == '.')
++ext;
- ap_str_tolower(hdlr);
+ apr_str_tolower(hdlr);
apr_table_setn(m->handlers, ext, hdlr);
return NULL;
}
@@ -402,7 +402,7 @@
while (ll[0]) {
char *ext = ap_getword_conf(p, &ll);
- ap_str_tolower(ext); /* ??? */
+ apr_str_tolower(ext); /* ??? */
apr_table_setn(hash_buckets[hash(ext[0])], ext, ct);
}
}
Index: modules/loggers/mod_log_config.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/loggers/mod_log_config.c,v
retrieving revision 1.60
diff -u -r1.60 mod_log_config.c
--- modules/loggers/mod_log_config.c 2001/05/22 01:31:06 1.60
+++ modules/loggers/mod_log_config.c 2001/05/30 04:01:24
@@ -428,7 +428,7 @@
const char *start_cookie;
if ((cookies = apr_table_get(r->headers_in, "Cookie"))) {
- if ((start_cookie = ap_strstr_c(cookies,a))) {
+ if ((start_cookie = apr_strstr_c(cookies,a))) {
char *cookie, *end_cookie;
start_cookie += strlen(a) + 1; /* cookie_name + '=' */
cookie = apr_pstrdup(r->pool, start_cookie);
Index: modules/mappers/mod_imap.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_imap.c,v
retrieving revision 1.32
diff -u -r1.32 mod_imap.c
--- modules/mappers/mod_imap.c 2001/02/28 15:24:07 1.32
+++ modules/mappers/mod_imap.c 2001/05/30 04:01:26
@@ -302,7 +302,7 @@
return (-1); /* in case we aren't passed anything */
}
- start_of_y = ap_strchr_c(args, ','); /* the comma */
+ start_of_y = apr_strchr_c(args, ','); /* the comma */
if (start_of_y) {
@@ -418,7 +418,7 @@
}
/* must be a relative URL to be combined with base */
- if (ap_strchr_c(base, '/') == NULL && (!strncmp(value, "../", 3)
+ if (apr_strchr_c(base, '/') == NULL && (!strncmp(value, "../", 3)
|| !strcmp(value, ".."))) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
"invalid base directive in map file: %s", r->uri);
Index: modules/mappers/mod_negotiation.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_negotiation.c,v
retrieving revision 1.57
diff -u -r1.57 mod_negotiation.c
--- modules/mappers/mod_negotiation.c 2001/04/10 20:28:01 1.57
+++ modules/mappers/mod_negotiation.c 2001/05/30 04:01:33
@@ -342,7 +342,7 @@
*/
result->name = ap_get_token(p, &accept_line, 0);
- ap_str_tolower(result->name); /* You want case insensitive,
+ apr_str_tolower(result->name); /* You want case insensitive,
* you'll *get* case insensitive.
*/
@@ -397,7 +397,7 @@
if (*end) {
*end = '\0'; /* strip ending quote or return */
}
- ap_str_tolower(cp);
+ apr_str_tolower(cp);
if (parm[0] == 'q'
&& (parm[1] == '\0' || (parm[1] == 's' && parm[2] == '\0'))) {
@@ -463,7 +463,7 @@
while (**lang_line) {
char **new = (char **) apr_array_push(lang_recs);
*new = ap_get_token(p, lang_line, 0);
- ap_str_tolower(*new);
+ apr_str_tolower(*new);
if (**lang_line == ',' || **lang_line == ';') {
++(*lang_line);
}
Index: modules/mappers/mod_rewrite.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_rewrite.c,v
retrieving revision 1.77
diff -u -r1.77 mod_rewrite.c
--- modules/mappers/mod_rewrite.c 2001/05/18 18:38:41 1.77
+++ modules/mappers/mod_rewrite.c 2001/05/30 04:01:41
@@ -859,7 +859,7 @@
else if ( strcasecmp(key, "type") == 0
|| strcasecmp(key, "T") == 0 ) {
cfg->forced_mimetype = apr_pstrdup(p, val);
- ap_str_tolower(cfg->forced_mimetype);
+ apr_str_tolower(cfg->forced_mimetype);
}
else if ( strcasecmp(key, "env") == 0
|| strcasecmp(key, "E") == 0 ) {
Index: modules/mappers/mod_speling.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_speling.c,v
retrieving revision 1.32
diff -u -r1.32 mod_speling.c
--- modules/mappers/mod_speling.c 2001/02/16 04:26:40 1.32
+++ modules/mappers/mod_speling.c 2001/05/30 04:01:43
@@ -272,7 +272,7 @@
* So we do this in steps. First break r->filename into two pieces
*/
- filoc = ap_rind(r->filename, '/');
+ filoc = apr_rind(r->filename, '/');
/*
* Don't do anything if the request doesn't contain a slash, or
* requests "/"
@@ -307,7 +307,7 @@
candidates = apr_array_make(r->pool, 2, sizeof(misspelled_file));
- dotloc = ap_ind(bad, '.');
+ dotloc = apr_ind(bad, '.');
if (dotloc == -1) {
dotloc = strlen(bad);
}
@@ -381,7 +381,7 @@
* (e.g. foo.gif and foo.html) This code will pick the first one
* it finds. Better than a Not Found, though.
*/
- int entloc = ap_ind(dirent.name, '.');
+ int entloc = apr_ind(dirent.name, '.');
if (entloc == -1) {
entloc = strlen(dirent.name);
}
Index: modules/mappers/mod_userdir.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_userdir.c,v
retrieving revision 1.38
diff -u -r1.38 mod_userdir.c
--- modules/mappers/mod_userdir.c 2001/02/22 20:50:03 1.38
+++ modules/mappers/mod_userdir.c 2001/05/30 04:01:44
@@ -276,7 +276,7 @@
char *filename = NULL;
apr_status_t rv;
- if (ap_strchr_c(userdir, '*'))
+ if (apr_strchr_c(userdir, '*'))
x = ap_getword(r->pool, &userdir, '*');
if (userdir[0] == '\0' || ap_os_is_path_absolute(userdir)) {
@@ -306,7 +306,7 @@
else
filename = apr_pstrcat(r->pool, userdir, "/", w, NULL);
}
- else if (ap_strchr_c(userdir, ':')) {
+ else if (apr_strchr_c(userdir, ':')) {
redirect = apr_pstrcat(r->pool, userdir, "/", w, dname, NULL);
apr_table_setn(r->headers_out, "Location", redirect);
return HTTP_MOVED_TEMPORARILY;
Index: modules/metadata/mod_mime_magic.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/metadata/mod_mime_magic.c,v
retrieving revision 1.43
diff -u -r1.43 mod_mime_magic.c
--- modules/metadata/mod_mime_magic.c 2001/03/19 16:07:59 1.43
+++ modules/metadata/mod_mime_magic.c 2001/05/30 04:01:48
@@ -841,7 +841,7 @@
encoding_pos, encoding_len);
/* XXX: this could be done at config time I'm sure... but I'm
* confused by all this magic_rsl stuff. -djg */
- ap_str_tolower(tmp);
+ apr_str_tolower(tmp);
r->content_encoding = tmp;
}
Index: server/config.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/config.c,v
retrieving revision 1.129
diff -u -r1.129 config.c
--- server/config.c 2001/05/11 23:33:46 1.129
+++ server/config.c 2001/05/30 04:01:54
@@ -277,7 +277,7 @@
if (!r->handler) {
handler = r->content_type ? r->content_type : ap_default_type(r);
- if ((p=ap_strchr_c(handler, ';')) != NULL) {
+ if ((p=apr_strchr_c(handler, ';')) != NULL) {
apr_cpystrn(hbuf, handler, sizeof hbuf);
p2 = hbuf+(handler-p);
handler = hbuf;
@@ -383,10 +383,10 @@
* components (Unix and DOS), and remove them.
*/
- if (ap_strrchr_c(m->name, '/'))
- m->name = 1 + ap_strrchr_c(m->name, '/');
- if (ap_strrchr_c(m->name, '\\'))
- m->name = 1 + ap_strrchr_c(m->name, '\\');
+ if (apr_strrchr_c(m->name, '/'))
+ m->name = 1 + apr_strrchr_c(m->name, '/');
+ if (apr_strrchr_c(m->name, '\\'))
+ m->name = 1 + apr_strrchr_c(m->name, '\\');
#ifdef _OSD_POSIX /*
__FILE__="*POSIX(/home/martin/apache/src/modules/standard/mod_info.c)" */
/* We cannot fix the string in-place, because it's const */
@@ -1096,7 +1096,7 @@
char *arg=apr_pstrdup(cmd->pool,arg_);
int offset = (int) (long) cmd->info;
- ap_str_tolower(arg);
+ apr_str_tolower(arg);
*(char **) ((char *)struct_ptr + offset) = arg;
return NULL;
}
Index: server/core.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/core.c,v
retrieving revision 1.16
diff -u -r1.16 core.c
--- server/core.c 2001/05/06 23:27:13 1.16
+++ server/core.c 2001/05/30 04:02:01
@@ -649,7 +649,7 @@
apr_socket_addr_get(&remote_addr, APR_REMOTE, conn->client_socket);
if (apr_getnameinfo(&conn->remote_host, remote_addr, 0) == APR_SUCCESS)
{
- ap_str_tolower(conn->remote_host);
+ apr_str_tolower(conn->remote_host);
if (hostname_lookups == HOSTNAME_LOOKUP_DOUBLE) {
do_double_reverse(conn);
@@ -743,7 +743,7 @@
if (apr_getnameinfo(&conn->local_host, local_addr, 0) !=
APR_SUCCESS)
conn->local_host = apr_pstrdup(conn->pool,
r->server->server_hostname);
else {
- ap_str_tolower(conn->local_host);
+ apr_str_tolower(conn->local_host);
}
}
return conn->local_host;
@@ -1271,7 +1271,7 @@
}
/* Heuristic to determine second argument. */
- if (ap_strchr_c(msg,' '))
+ if (apr_strchr_c(msg,' '))
what = MSG;
else if (msg[0] == '/')
what = LOCAL_PATH;
@@ -1540,7 +1540,7 @@
static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
{
const char *errmsg;
- const char *endp = ap_strrchr_c(arg, '>');
+ const char *endp = apr_strrchr_c(arg, '>');
int old_overrides = cmd->override;
char *old_path = cmd->path;
core_dir_config *conf;
@@ -1613,7 +1613,7 @@
static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg)
{
const char *errmsg;
- const char *endp = ap_strrchr_c(arg, '>');
+ const char *endp = apr_strrchr_c(arg, '>');
int old_overrides = cmd->override;
char *old_path = cmd->path;
core_dir_config *conf;
@@ -1671,7 +1671,7 @@
static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg)
{
const char *errmsg;
- const char *endp = ap_strrchr_c(arg, '>');
+ const char *endp = apr_strrchr_c(arg, '>');
int old_overrides = cmd->override;
char *old_path = cmd->path;
core_dir_config *conf;
@@ -1736,7 +1736,7 @@
static const char *start_ifmod(cmd_parms *cmd, void *mconfig, const char *arg)
{
- const char *endp = ap_strrchr_c(arg, '>');
+ const char *endp = apr_strrchr_c(arg, '>');
int not = (arg[0] == '!');
module *found;
@@ -1788,7 +1788,7 @@
int defined;
int not = 0;
- endp = ap_strrchr_c(arg, '>');
+ endp = apr_strrchr_c(arg, '>');
if (endp == NULL) {
return unclosed_directive(cmd);
}
@@ -1824,7 +1824,7 @@
{
server_rec *main_server = cmd->server, *s;
const char *errmsg;
- const char *endp = ap_strrchr_c(arg, '>');
+ const char *endp = apr_strrchr_c(arg, '>');
apr_pool_t *p = cmd->pool;
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
Index: server/request.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/request.c,v
retrieving revision 1.3
diff -u -r1.3 request.c
--- server/request.c 2001/03/25 17:38:18 1.3
+++ server/request.c 2001/05/30 04:02:04
@@ -998,7 +998,7 @@
* not even have to redo access checks.
*/
- if (ap_strchr_c(new_file, '/') == NULL) {
+ if (apr_strchr_c(new_file, '/') == NULL) {
char *udir = ap_make_dirstr_parent(rnew->pool, r->uri);
apr_status_t rv;
Index: server/util.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/util.c,v
retrieving revision 1.106
diff -u -r1.106 util.c
--- server/util.c 2001/02/25 01:12:50 1.106
+++ server/util.c 2001/05/30 04:02:07
@@ -125,7 +125,7 @@
if (intype == NULL) return NULL;
- semi = ap_strchr_c(intype, ';');
+ semi = apr_strchr_c(intype, ';');
if (semi == NULL) {
return apr_pstrdup(p, intype);
}
@@ -594,7 +594,7 @@
*/
AP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s)
{
- const char *last_slash = ap_strrchr_c(s, '/');
+ const char *last_slash = apr_strrchr_c(s, '/');
char *d;
int l;
@@ -627,7 +627,7 @@
AP_DECLARE(char *) ap_getword(apr_pool_t *atrans, const char **line, char stop)
{
- const char *pos = ap_strchr_c(*line, stop);
+ const char *pos = apr_strchr_c(*line, stop);
char *res;
if (!pos) {
@@ -688,7 +688,7 @@
AP_DECLARE(char *) ap_getword_nulls(apr_pool_t *atrans, const char **line,
char stop)
{
- const char *pos = ap_strchr_c(*line, stop);
+ const char *pos = apr_strchr_c(*line, stop);
char *res;
if (!pos) {
@@ -790,14 +790,14 @@
const char *s, *e;
tmp[0] = '\0';
- if (!(s=ap_strchr_c(word,'$')))
+ if (!(s=apr_strchr_c(word,'$')))
return word;
do {
/* XXX - relies on strncat() to add '\0'
*/
strncat(tmp,word,s - word);
- if ((s[1] == '{') && (e=ap_strchr_c(s,'}'))) {
+ if ((s[1] == '{') && (e=apr_strchr_c(s,'}'))) {
const char *e2 = e;
word = e + 1;
e = getenv(s+2);
@@ -812,7 +812,7 @@
word = s+1;
strcat(tmp,"$");
};
- } while ((s=ap_strchr_c(word,'$')));
+ } while ((s=apr_strchr_c(word,'$')));
strcat(tmp,word);
return apr_pstrdup(p,tmp);
@@ -1604,8 +1604,8 @@
unsigned c;
if (!partial) {
- const char *colon = ap_strchr_c(path, ':');
- const char *slash = ap_strchr_c(path, '/');
+ const char *colon = apr_strchr_c(path, ':');
+ const char *slash = apr_strchr_c(path, '/');
if (colon && (!slash || colon < slash)) {
*d++ = '.';
@@ -1716,31 +1716,6 @@
return (x ? 1 : 0); /* If the first character is ':', it's
broken, too */
}
-AP_DECLARE(int) ap_ind(const char *s, char c)
-{
- const char *p = ap_strchr_c(s, c);
-
- if (p == NULL)
- return -1;
- return p - s;
-}
-
-AP_DECLARE(int) ap_rind(const char *s, char c)
-{
- const char *p = ap_strrchr_c(s, c);
-
- if (p == NULL)
- return -1;
- return p - s;
-}
-
-AP_DECLARE(void) ap_str_tolower(char *str)
-{
- while (*str) {
- *str = apr_tolower(*str);
- ++str;
- }
-}
static char *find_fqdn(apr_pool_t *a, struct hostent *p)
{
Index: server/util_debug.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/util_debug.c,v
retrieving revision 1.5
diff -u -r1.5 util_debug.c
--- server/util_debug.c 2001/02/18 02:58:53 1.5
+++ server/util_debug.c 2001/05/30 04:02:07
@@ -62,37 +62,6 @@
#include "httpd.h"
#include "http_config.h"
-#ifdef AP_DEBUG
-
-/* get rid of the macros we defined in httpd.h */
-#undef strchr
-#undef strrchr
-#undef strstr
-
-char *ap_strchr(char *s, int c)
-{
- return strchr(s,c);
-}
-const char *ap_strchr_c(const char *s, int c)
-{
- return strchr(s,c);
-}
-char *ap_strrchr(char *s, int c)
-{
- return strrchr(s,c);
-}
-const char *ap_strrchr_c(const char *s, int c)
-{
- return strrchr(s,c);
-}
-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);
-}
AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
Index: server/util_script.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/util_script.c,v
retrieving revision 1.57
diff -u -r1.57 util_script.c
--- server/util_script.c 2001/05/08 20:55:23 1.57
+++ server/util_script.c 2001/05/30 04:02:09
@@ -585,11 +585,11 @@
if (!strs->curpos || !*strs->curpos)
return 0;
- p = ap_strchr_c(strs->curpos, '\n');
+ p = apr_strchr_c(strs->curpos, '\n');
if (p)
++p;
else
- p = ap_strchr_c(strs->curpos, '\0');
+ p = apr_strchr_c(strs->curpos, '\0');
t = p - strs->curpos;
if (t > len)
t = len;
Index: srclib/apr/include/apr_strings.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_strings.h,v
retrieving revision 1.17
diff -u -r1.17 apr_strings.h
--- srclib/apr/include/apr_strings.h 2001/05/23 14:15:39 1.17
+++ srclib/apr/include/apr_strings.h 2001/05/30 04:02:20
@@ -276,6 +276,57 @@
APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format,
va_list ap);
+/**
+ * convert a string to all lowercase
+ * @param s The string to convert to lowercase
+ */
+APR_DECLARE(void) apr_str_tolower(char *s);
+
+/**
+ * Search a string from left to right for the first occurrence of a
+ * specific character
+ * @param str The string to search
+ * @param c The character to search for
+ * @return The index of the first occurrence of c in str
+ */
+APR_DECLARE(int) apr_ind(const char *str, char c); /* Sigh... */
+
+/**
+ * Search a string from right to left for the first occurrence of a
+ * specific character
+ * @param str The string to search
+ * @param c The character to search for
+ * @return The index of the first occurrence of c in str
+ */
+APR_DECLARE(int) apr_rind(const char *str, char c);
+
+#ifdef APR_DEBUG
+
+#undef strchr
+# define strchr(s, c) apr_strchr(s,c)
+#undef strrchr
+# define strrchr(s, c) apr_strrchr(s,c)
+#undef strstr
+# define strstr(s, c) apr_strstr(s,c)
+
+char *apr_strchr(char *s, int c);
+const char *apr_strchr_c(const char *s, int c);
+char *apr_strrchr(char *s, int c);
+const char *apr_strrchr_c(const char *s, int c);
+char *apr_strstr(char *s, char *c);
+const char *apr_strstr_c(const char *s, const char *c);
+
+#else
+
+# define apr_strchr(s, c) strchr(s, c)
+# define apr_strchr_c(s, c) strchr(s, c)
+# define apr_strrchr(s, c) strrchr(s, c)
+# define apr_strrchr_c(s, c) strrchr(s, c)
+# define apr_strstr(s, c) strstr(s, c)
+# define apr_strstr_c(s, c) strstr(s, c)
+
+#endif
+
#ifdef __cplusplus
}
#endif
Index: srclib/apr/strings/apr_strings.c
===================================================================
RCS file: /home/cvspublic/apr/strings/apr_strings.c,v
retrieving revision 1.13
diff -u -r1.13 apr_strings.c
--- srclib/apr/strings/apr_strings.c 2001/05/10 18:05:18 1.13
+++ srclib/apr/strings/apr_strings.c 2001/05/30 04:02:34
@@ -147,7 +147,32 @@
return res;
}
+APR_DECLARE(int) apr_ind(const char *s, char c)
+{
+ const char *p = apr_strchr_c(s, c);
+
+ if (p == NULL)
+ return -1;
+ return p - s;
+}
+
+APR_DECLARE(int) apr_rind(const char *s, char c)
+{
+ const char *p = apr_strrchr_c(s, c);
+
+ if (p == NULL)
+ return -1;
+ return p - s;
+}
+APR_DECLARE(void) apr_str_tolower(char *str)
+{
+ while (*str) {
+ *str = apr_tolower(*str);
+ ++str;
+ }
+}
+
#if (!APR_HAVE_MEMCHR)
void *memchr(const void *s, int c, size_t n)
{
@@ -161,3 +186,36 @@
return NULL;
}
#endif
+
+#ifdef APR_DEBUG
+
+/* get rid of the macros we defined in httpd.h */
+#undef strchr
+#undef strrchr
+#undef strstr
+
+char *apr_strchr(char *s, int c)
+{
+ return strchr(s,c);
+}
+const char *apr_strchr_c(const char *s, int c)
+{
+ return strchr(s,c);
+}
+char *apr_strrchr(char *s, int c)
+{
+ return strrchr(s,c);
+}
+const char *apr_strrchr_c(const char *s, int c)
+{
+ return strrchr(s,c);
+}
+char *apr_strstr(char *s, char *c)
+{
+ return strstr(s,c);
+}
+const char *apr_strstr_c(const char *s, const char *c)
+{
+ return strstr(s,c);
+}
+#endif