git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5831 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-09 15:29:18 +00:00
parent 7620b26b94
commit cdb5862d40
2 changed files with 16 additions and 19 deletions

View File

@ -263,10 +263,8 @@ static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switc
encode_len = new_len; encode_len = new_len;
if (!(tmp = realloc(encode_buf, encode_len))) { tmp = realloc(encode_buf, encode_len);
goto done; assert(tmp);
}
encode_buf = tmp; encode_buf = tmp;
} }

View File

@ -341,31 +341,34 @@ SWITCH_DECLARE(char *) switch_channel_get_variable(switch_channel_t *channel, co
SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel) SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel)
{ {
assert(channel != NULL); assert(channel != NULL);
if (channel->vi) { if (!channel->vi) {
switch_mutex_unlock(channel->profile_mutex); return;
channel->vi = 0;
} }
channel->vi = 0;
switch_mutex_unlock(channel->profile_mutex);
} }
SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_channel_t *channel) SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_channel_t *channel)
{ {
switch_event_header_t *hi = NULL;
assert(channel != NULL); assert(channel != NULL);
if (channel->vi) { switch_mutex_lock(channel->profile_mutex);
return NULL; if ((hi = channel->variables->headers)) {
channel->vi = 1;
} else {
switch_mutex_unlock(channel->profile_mutex);
} }
switch_mutex_lock(channel->profile_mutex); return hi;
channel->vi = 1;
return channel->variables->headers;
} }
SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info) SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
{ {
assert(channel != NULL); assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
switch_core_hash_insert_locked(channel->private_hash, key, private_info, channel->profile_mutex); switch_core_hash_insert_locked(channel->private_hash, key, private_info, channel->profile_mutex);
switch_mutex_unlock(channel->profile_mutex);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
@ -373,9 +376,7 @@ SWITCH_DECLARE(void *) switch_channel_get_private(switch_channel_t *channel, con
{ {
void *val; void *val;
assert(channel != NULL); assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex); val = switch_core_hash_find_locked(channel->private_hash, key, channel->profile_mutex);
val = switch_core_hash_find(channel->private_hash, key);
switch_mutex_unlock(channel->profile_mutex);
return val; return val;
} }
@ -870,11 +871,9 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit
{ {
switch_caller_profile_t *profile; switch_caller_profile_t *profile;
assert(channel != NULL); assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex); switch_mutex_lock(channel->profile_mutex);
profile = channel->caller_profile; profile = channel->caller_profile;
switch_mutex_unlock(channel->profile_mutex); switch_mutex_unlock(channel->profile_mutex);
return profile; return profile;
} }