mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
switch_channel_set_variable_nodup which does not dup the value from the session pool. The value MUST already be allocated from the pool for that session, or very bad things could happen. Use with caution.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4329 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -373,6 +373,23 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *ch
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_nodup(switch_channel_t *channel, const char *varname, char *value)
|
||||
{
|
||||
assert(channel != NULL);
|
||||
|
||||
if (varname) {
|
||||
switch_core_hash_delete(channel->variables, varname);
|
||||
if (!switch_strlen_zero(value)) {
|
||||
switch_core_hash_insert_dup(channel->variables, varname, value);
|
||||
} else {
|
||||
switch_core_hash_delete(channel->variables, varname);
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags)
|
||||
{
|
||||
assert(channel != NULL);
|
||||
|
Reference in New Issue
Block a user