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:
Michael Jerris
2007-02-19 22:57:27 +00:00
parent ad6cca6737
commit 58705374f4
2 changed files with 26 additions and 0 deletions

View File

@@ -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);