give embedded modules a helping hand by backing up and restoring their global variables when they are loaded and unloaded

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@56092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2007-02-22 02:36:00 +00:00
parent a6cbe5d651
commit 1bec2f5bfa
5 changed files with 143 additions and 5 deletions

View File

@@ -483,6 +483,9 @@ int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode f
if (!error)
ast_update_use_count();
if (!error && !mod->lib)
mod->info->restore_globals();
return res;
}
@@ -627,6 +630,11 @@ static enum ast_module_load_result load_resource(const char *resource_name, unsi
return AST_MODULE_LOAD_DECLINE;
}
if (!mod->lib && mod->info->backup_globals()) {
ast_log(LOG_WARNING, "Module '%s' was unable to backup its global data.\n", resource_name);
return AST_MODULE_LOAD_DECLINE;
}
ast_clear_flag(mod, FLAG_DECLINED);
if (mod->info->load)