From d3e1f400e5b48508003e473eab7b62710f146600 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 22 Jan 2007 21:59:07 +0000 Subject: [PATCH] tweak core for build err and add core_get_var git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4021 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_core.h | 7 +++++++ src/switch_core.c | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 30ddf46229..cb07dd2ebb 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -472,6 +472,13 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(char *uuid_st */ SWITCH_DECLARE(char *) switch_core_get_variable(char *varname); +/*! + \brief Add a global variable to the core + \param varname the name of the variable + \param value the value of the variable +*/ +SWITCH_DECLARE(void) switch_core_set_variable(char *varname, char *value); + /*! \brief Hangup All Sessions \param cause the hangup cause to apply to the hungup channels diff --git a/src/switch_core.c b/src/switch_core.c index eb2bc83c49..626dba442b 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -610,6 +610,11 @@ SWITCH_DECLARE(char *) switch_core_get_variable(char *varname) return (char *) switch_core_hash_find(runtime.global_vars, varname); } +SWITCH_DECLARE(void) switch_core_set_variable(char *varname, char *value) +{ + switch_core_hash_insert(runtime.global_vars, switch_core_strdup(runtime.memory_pool, varname), switch_core_strdup(runtime.memory_pool, value)); +} + #ifdef SWITCH_DEBUG_RWLOCKS SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(char *uuid_str, @@ -2881,7 +2886,7 @@ static void print_trace (void) #endif -static int handle_fatality(int sig) +static void handle_fatality(int sig) { switch_thread_id_t thread_id; jmp_buf *env; @@ -2909,10 +2914,10 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) jmp_buf env; int sig; - signal(SIGSEGV, (void *) handle_fatality); - signal(SIGFPE, (void *) handle_fatality); + signal(SIGSEGV, handle_fatality); + signal(SIGFPE, handle_fatality); #ifndef WIN32 - signal(SIGBUS, (void *) handle_fatality); + signal(SIGBUS, handle_fatality); #endif if ((sig = setjmp(env)) != 0) {