come down from the acid trip from the last commit
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3561 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d48e3bafa8
commit
20bc2fde18
|
@ -1107,6 +1107,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define resize(l) {\
|
||||||
|
char *dp;\
|
||||||
|
olen += (len + l + block);\
|
||||||
|
cpos = c - data;\
|
||||||
|
if ((dp = realloc(data, olen))) {\
|
||||||
|
data = dp;\
|
||||||
|
c = data + cpos;\
|
||||||
|
memset(c, 0, olen - cpos);\
|
||||||
|
}} \
|
||||||
|
|
||||||
SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel, char *in)
|
SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel, char *in)
|
||||||
{
|
{
|
||||||
char *p, *c;
|
char *p, *c;
|
||||||
|
@ -1129,15 +1139,17 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
|
||||||
|
|
||||||
if (*p == '$') {
|
if (*p == '$') {
|
||||||
vtype = 1;
|
vtype = 1;
|
||||||
}
|
if (*(p+1) != '{') {
|
||||||
if (*(p+1) != '{') {
|
vtype = 2;
|
||||||
vtype = 2;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vtype) {
|
if (vtype) {
|
||||||
char *s = p, *e, *vname, *vval = NULL;
|
char *s = p, *e, *vname, *vval = NULL;
|
||||||
size_t nlen;
|
size_t nlen;
|
||||||
|
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
if (vtype == 1 && *s == '{') {
|
if (vtype == 1 && *s == '{') {
|
||||||
br = 1;
|
br = 1;
|
||||||
s++;
|
s++;
|
||||||
|
@ -1195,24 +1207,23 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
|
||||||
}
|
}
|
||||||
if ((nlen = sub_val ? strlen(sub_val) : 0)) {
|
if ((nlen = sub_val ? strlen(sub_val) : 0)) {
|
||||||
if (len + nlen >= olen) {
|
if (len + nlen >= olen) {
|
||||||
char *dp;
|
resize(nlen);
|
||||||
olen += (len + nlen + block);
|
|
||||||
cpos = c - data;
|
|
||||||
if ((dp = realloc(data, olen))) {
|
|
||||||
data = dp;
|
|
||||||
c = data + cpos;
|
|
||||||
memset(c, 0, olen - cpos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
len += nlen;
|
len += nlen;
|
||||||
strcat(c, sub_val);
|
strcat(c, sub_val);
|
||||||
c += nlen;
|
c += nlen;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_safe_free(func_val);
|
switch_safe_free(func_val);
|
||||||
|
sub_val = NULL;
|
||||||
|
vname = NULL;
|
||||||
|
vtype = 0;
|
||||||
}
|
}
|
||||||
|
if (len + 1 >= olen) {
|
||||||
|
resize(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (sp) {
|
if (sp) {
|
||||||
*c++ = ' ';
|
*c++ = ' ';
|
||||||
sp = 0;
|
sp = 0;
|
||||||
|
|
Loading…
Reference in New Issue