in flood_profile.c [501:577]
static apr_status_t initialize_events(profile_events_t **events, const char * profile_name, config_t *config, apr_pool_t *pool)
{
apr_status_t stat;
const char **p;
profile_events_t *new_events;
struct apr_xml_elem *root_elem, *profile_elem, *profile_event_elem;
char *xml_profile;
xml_profile = apr_pstrdup(pool, XML_PROFILE);
if ((stat = retrieve_root_xml_elem(&root_elem, config)) != APR_SUCCESS) {
return stat;
}
if ((stat = create_profile_events(&new_events, pool)) != APR_SUCCESS) {
return stat;
}
/* retrieve our profile xml element */
if ((stat = retrieve_xml_elem_with_childmatch(
&profile_elem, root_elem,
xml_profile, "name", profile_name)) != APR_SUCCESS)
return stat;
/* For each event in the profile_events_t struct, allow the config
* parameters to override an implementation.
*/
for (p = &profile_group_handler_names[0]; *p; p++) {
stat = retrieve_xml_elem_child(&profile_event_elem, profile_elem, *p);
/* We found a match */
if (stat == APR_SUCCESS)
{
stat = assign_profile_group_handler(new_events, *p,
profile_event_elem->first_cdata.first->text);
if (stat != APR_SUCCESS)
return stat;
}
}
/* For each event in the profile_events_t struct, allow the config
* parameters to override an implementation.
*/
for (p = &profile_event_handler_names[0]; *p; p++) {
if ((stat = retrieve_xml_elem_child(
&profile_event_elem,
profile_elem,
*p)) == APR_SUCCESS) {
/* search for the implementation in our tables and assign it */
if ((stat = assign_profile_event_handler(
new_events,
*p,
profile_event_elem->first_cdata.first->text)) != APR_SUCCESS) {
#ifdef PROFILE_DEBUG
apr_file_printf(local_stdout, "Profile '%s' failed to override '%s' with '%s'.\n",
profile_name, *p, profile_event_elem->first_cdata.first->text);
#endif /* PROFILE_DEBUG */
return stat;
} else {
#ifdef PROFILE_DEBUG
apr_file_printf(local_stdout, "Profile '%s' overrides '%s' with '%s'.\n",
profile_name, *p, profile_event_elem->first_cdata.first->text);
#endif /* PROFILE_DEBUG */
}
} else {
#ifdef PROFILE_DEBUG
apr_file_printf(local_stdout, "Profile '%s' uses default '%s'.\n",
profile_name, *p);
#endif /* PROFILE_DEBUG */
}
}
*events = new_events;
return APR_SUCCESS;
}