From 981c4371bfba632208a93272ce45a3514ed447fa Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 24 Sep 2007 16:56:40 +0000 Subject: [PATCH] fix for FSCORE-51 (maybe 2) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5750 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_channel.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index e7f0322e7e..700cc26463 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -360,7 +360,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *cha { assert(channel != NULL); switch_mutex_lock(channel->profile_mutex); - switch_core_hash_insert_dup_locked(channel->private_hash, switch_core_session_strdup(channel->session, key), private_info, channel->flag_mutex); + switch_core_hash_insert_dup_locked(channel->private_hash, switch_core_session_strdup(channel->session, key), private_info, channel->profile_mutex); switch_mutex_unlock(channel->profile_mutex); return SWITCH_STATUS_SUCCESS; } @@ -398,15 +398,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *ch { assert(channel != NULL); - if (varname) { + if (!switch_strlen_zero(varname)) { switch_mutex_lock(channel->profile_mutex); - switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex); + switch_core_hash_delete(channel->variables, varname); if (!switch_strlen_zero(value)) { - switch_core_hash_insert_dup_locked(channel->variables, varname, - switch_clean_string(switch_core_session_strdup(channel->session, value)), channel->flag_mutex); - } else { - switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex); - } + switch_core_hash_insert_dup(channel->variables, varname, + switch_clean_string(switch_core_session_strdup(channel->session, value))); + } switch_mutex_unlock(channel->profile_mutex); return SWITCH_STATUS_SUCCESS; } @@ -418,14 +416,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_nodup(switch_channel { assert(channel != NULL); - if (varname) { + if (!switch_strlen_zero(varname)) { switch_mutex_lock(channel->profile_mutex); - switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex); + switch_core_hash_delete(channel->variables, varname); if (!switch_strlen_zero(value)) { - switch_core_hash_insert_dup_locked(channel->variables, varname, value, channel->flag_mutex); - } else { - switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex); - } + switch_core_hash_insert_dup(channel->variables, varname, value); + } switch_mutex_unlock(channel->profile_mutex); return SWITCH_STATUS_SUCCESS; }