[asterisk-commits] rmudgett: trunk r366462 - /trunk/channels/chan_local.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 14 16:34:18 CDT 2012
Author: rmudgett
Date: Mon May 14 16:34:14 2012
New Revision: 366462
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=366462
Log:
Make chan_local use the API call instead of inlining its own version.
Modified:
trunk/channels/chan_local.c
Modified: trunk/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_local.c?view=diff&rev=366462&r1=366461&r2=366462
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Mon May 14 16:34:14 2012
@@ -861,8 +861,8 @@
struct ast_channel *owner = NULL;
struct ast_channel *chan = NULL;
int res;
- struct ast_var_t *varptr = NULL, *new;
- size_t len, namelen;
+ struct ast_var_t *varptr;
+ struct ast_var_t *clone_var;
char *reduced_dest = ast_strdupa(dest);
char *slash;
const char *exten;
@@ -919,12 +919,9 @@
/* copy the channel variables from the incoming channel to the outgoing channel */
/* Note that due to certain assumptions, they MUST be in the same order */
AST_LIST_TRAVERSE(ast_channel_varshead(owner), varptr, entries) {
- namelen = strlen(varptr->name);
- len = sizeof(struct ast_var_t) + namelen + strlen(varptr->value) + 2;
- if ((new = ast_calloc(1, len))) {
- memcpy(new, varptr, len);
- new->value = &(new->name[0]) + namelen + 1;
- AST_LIST_INSERT_TAIL(ast_channel_varshead(chan), new, entries);
+ clone_var = ast_var_assign(varptr->name, varptr->value);
+ if (clone_var) {
+ AST_LIST_INSERT_TAIL(ast_channel_varshead(chan), clone_var, entries);
}
}
ast_channel_datastore_inherit(owner, chan);
More information about the asterisk-commits
mailing list