mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
Lets make the parser free its stuff on shutdown, and let the callbacks do something if required
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12467 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -273,7 +273,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *ev
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback(item, changed);
|
||||
callback(item, (reload ? CONFIG_RELOAD : CONFIG_LOAD), changed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,6 +299,36 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *ev
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_xml_config_cleanup(switch_xml_config_item_t *instructions)
|
||||
{
|
||||
switch_xml_config_item_t *item;
|
||||
|
||||
for (item = instructions; item->key; item++) {
|
||||
switch_xml_config_callback_t callback = (switch_xml_config_callback_t)item->function;
|
||||
|
||||
switch (item->type) {
|
||||
case SWITCH_CONFIG_STRING:
|
||||
{
|
||||
char **ptr = (char**)item->ptr;
|
||||
switch_xml_config_string_options_t *string_options = (switch_xml_config_string_options_t*)item->data;
|
||||
/* if (using_strdup) */
|
||||
if (string_options && !string_options->pool && !string_options->length) {
|
||||
switch_safe_free(*ptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback(item, CONFIG_SHUTDOWN, SWITCH_FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
|
Reference in New Issue
Block a user