1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements.  See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License.  You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define APR_WANT_STRFUNC
18#include "apr_want.h"
19
20#include "httpd.h"
21#include "http_config.h"
22
23/* Possibly get rid of the macros we defined in httpd.h */
24#if defined(strchr)
25#undef strchr
26#endif
27
28#if defined (strrchr)
29#undef strrchr
30#endif
31
32#if defined (strstr)
33#undef strstr
34#endif
35
36
37#if defined(ap_strchr)
38#undef ap_strchr
39AP_DECLARE(char *) ap_strchr(char *s, int c);
40#endif
41
42AP_DECLARE(char *) ap_strchr(char *s, int c)
43{
44    return strchr(s,c);
45}
46
47#if defined(ap_strchr_c)
48#undef ap_strchr_c
49AP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
50#endif
51
52AP_DECLARE(const char *) ap_strchr_c(const char *s, int c)
53{
54    return strchr(s,c);
55}
56
57#if defined(ap_strrchr)
58#undef ap_strrchr
59AP_DECLARE(char *) ap_strrchr(char *s, int c);
60#endif
61
62AP_DECLARE(char *) ap_strrchr(char *s, int c)
63{
64    return strrchr(s,c);
65}
66
67#if defined(ap_strrchr_c)
68#undef ap_strrchr_c
69AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
70#endif
71
72AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c)
73{
74    return strrchr(s,c);
75}
76
77#if defined(ap_strstr)
78#undef ap_strstr
79AP_DECLARE(char *) ap_strstr(char *s, const char *c);
80#endif
81
82AP_DECLARE(char *) ap_strstr(char *s, const char *c)
83{
84    return strstr(s,c);
85}
86
87#if defined(ap_strstr_c)
88#undef ap_strstr_c
89AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
90#endif
91
92AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c)
93{
94    return strstr(s,c);
95}
96
97#if defined(ap_get_module_config)
98#undef ap_get_module_config
99AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
100                                        const module *m);
101#endif
102
103AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
104                                        const module *m)
105{
106    return ((void **)cv)[m->module_index];
107}
108
109/**
110 * Generic accessors for other modules to set at their own module-specific
111 * data
112 * @param conf_vector The vector in which the modules configuration is stored.
113 *        usually r->per_dir_config or s->module_config
114 * @param m The module to set the data for.
115 * @param val The module-specific data to set
116 * @deffunc void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val)
117 */
118#if defined(ap_set_module_config)
119#undef ap_set_module_config
120AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
121                                      void *val);
122#endif
123
124AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
125                                      void *val)
126{
127    ((void **)cv)[m->module_index] = val;
128}
129