MCPcopy Create free account
hub / github.com/apache/httpd / merge_core_dir_configs

Function merge_core_dir_configs

server/core.c:221–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
222{
223 core_dir_config *base = (core_dir_config *)basev;
224 core_dir_config *new = (core_dir_config *)newv;
225 core_dir_config *conf;
226
227 /* Create this conf by duplicating the base, replacing elements
228 * (or creating copies for merging) where new-> values exist.
229 */
230 conf = (core_dir_config *)apr_pmemdup(a, base, sizeof(core_dir_config));
231
232 conf->d = new->d;
233 conf->d_is_fnmatch = new->d_is_fnmatch;
234 conf->d_components = new->d_components;
235 conf->r = new->r;
236 conf->refs = new->refs;
237 conf->condition = new->condition;
238
239 if (new->opts & OPT_UNSET) {
240 /* there was no explicit setting of new->opts, so we merge
241 * preserve the invariant (opts_add & opts_remove) == 0
242 */
243 conf->opts_add = (conf->opts_add & ~new->opts_remove) | new->opts_add;
244 conf->opts_remove = (conf->opts_remove & ~new->opts_add)
245 | new->opts_remove;
246 conf->opts = (conf->opts & ~conf->opts_remove) | conf->opts_add;
247
248 /* If Includes was enabled with exec in the base config, but
249 * was enabled without exec in the new config, then disable
250 * exec in the merged set. */
251 if (((base->opts & (OPT_INCLUDES|OPT_INC_WITH_EXEC))
252 == (OPT_INCLUDES|OPT_INC_WITH_EXEC))
253 && ((new->opts & (OPT_INCLUDES|OPT_INC_WITH_EXEC))
254 == OPT_INCLUDES)) {
255 conf->opts &= ~OPT_INC_WITH_EXEC;
256 }
257 }
258 else {
259 /* otherwise we just copy, because an explicit opts setting
260 * overrides all earlier +/- modifiers
261 */
262 conf->opts = new->opts;
263 conf->opts_add = new->opts_add;
264 conf->opts_remove = new->opts_remove;
265 }
266
267 if (!(new->override & OR_UNSET)) {
268 conf->override = new->override;
269 }
270
271 if (!(new->override_opts & OPT_UNSET)) {
272 conf->override_opts = new->override_opts;
273 }
274
275 if (new->override_list != NULL) {
276 conf->override_list = new->override_list;
277 }
278

Callers

nothing calls this directly

Calls 2

ap_new_log_configFunction · 0.85
ap_merge_log_configFunction · 0.85

Tested by

no test coverage detected