[asterisk-commits] rmudgett: branch 12 r397976 - in /branches/12: funcs/ main/ tests/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 29 20:00:43 CDT 2013
Author: rmudgett
Date: Thu Aug 29 20:00:41 2013
New Revision: 397976
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397976
Log:
Revert last commit.
Modified:
branches/12/funcs/func_cdr.c
branches/12/main/pbx.c
branches/12/tests/test_substitution.c
Modified: branches/12/funcs/func_cdr.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/funcs/func_cdr.c?view=diff&rev=397976&r1=397975&r2=397976
==============================================================================
--- branches/12/funcs/func_cdr.c (original)
+++ branches/12/funcs/func_cdr.c Thu Aug 29 20:00:41 2013
@@ -269,10 +269,8 @@
return 0;
}
fmt_time.tv_usec = tv_usec;
- if (fmt_time.tv_sec || fmt_time.tv_usec) {
- ast_localtime(&fmt_time, &tm, NULL);
- ast_strftime(tempbuf, sizeof(*tempbuf), "%Y-%m-%d %T", &tm);
- }
+ ast_localtime(&fmt_time, &tm, NULL);
+ ast_strftime(tempbuf, sizeof(*tempbuf), "%Y-%m-%d %T", &tm);
} else if (!strcasecmp("disposition", args.variable)) {
int disposition;
Modified: branches/12/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/pbx.c?view=diff&rev=397976&r1=397975&r2=397976
==============================================================================
--- branches/12/main/pbx.c (original)
+++ branches/12/main/pbx.c Thu Aug 29 20:00:41 2013
@@ -4479,12 +4479,11 @@
/* Substitute if necessary */
if (needsub) {
- size_t my_used;
-
- if (!ltmp) {
+ size_t used;
+ if (!ltmp)
ltmp = ast_alloca(VAR_BUF_SIZE);
- }
- pbx_substitute_variables_helper_full(c, headp, var, ltmp, VAR_BUF_SIZE - 1, &my_used);
+
+ pbx_substitute_variables_helper_full(c, headp, var, ltmp, VAR_BUF_SIZE - 1, &used);
vars = ltmp;
} else {
vars = var;
@@ -4569,12 +4568,11 @@
/* Substitute if necessary */
if (needsub) {
- size_t my_used;
-
- if (!ltmp) {
+ size_t used;
+ if (!ltmp)
ltmp = ast_alloca(VAR_BUF_SIZE);
- }
- pbx_substitute_variables_helper_full(c, headp, var, ltmp, VAR_BUF_SIZE - 1, &my_used);
+
+ pbx_substitute_variables_helper_full(c, headp, var, ltmp, VAR_BUF_SIZE - 1, &used);
vars = ltmp;
} else {
vars = var;
Modified: branches/12/tests/test_substitution.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/tests/test_substitution.c?view=diff&rev=397976&r1=397975&r2=397976
==============================================================================
--- branches/12/tests/test_substitution.c (original)
+++ branches/12/tests/test_substitution.c Thu Aug 29 20:00:41 2013
@@ -53,17 +53,16 @@
char workspace[4096];
struct ast_str *str = ast_str_create(16);
+ ast_test_status_update(test, "Testing '%s' . . . . . %s\n", expression, okay ? "passed" : "FAILED");
for (i = 0; i < 256; i++) {
*ifield = i;
ast_str_substitute_variables(&str, 0, c, expression);
pbx_substitute_variables_helper(c, expression, workspace, sizeof(workspace));
-
if (sscanf(workspace, "%d", &value1) != 1 || value1 != i || sscanf(ast_str_buffer(str), "%d", &value2) != 1 || value2 != i) {
ast_test_status_update(test, "%s != %s and/or %d != %d != %d\n", ast_str_buffer(str), workspace, value1, value2, i);
okay = 0;
}
}
- ast_test_status_update(test, "Tested '%s' . . . . . %s\n", expression, okay ? "passed" : "FAILED");
ast_free(str);
@@ -77,17 +76,16 @@
char workspace[4096];
struct ast_str *str = ast_str_create(16);
+ ast_test_status_update(test, "Testing '%s' . . . . . %s\n", expression, okay ? "passed" : "FAILED");
for (i = 0; i < 256; i++) {
setter(c, i);
ast_str_substitute_variables(&str, 0, c, expression);
pbx_substitute_variables_helper(c, expression, workspace, sizeof(workspace));
-
if (sscanf(workspace, "%d", &value1) != 1 || value1 != i || sscanf(ast_str_buffer(str), "%d", &value2) != 1 || value2 != i) {
ast_test_status_update(test, "%s != %s and/or %d != %d != %d\n", ast_str_buffer(str), workspace, value1, value2, i);
okay = 0;
}
}
- ast_test_status_update(test, "Tested '%s' . . . . . %s\n", expression, okay ? "passed" : "FAILED");
ast_free(str);
@@ -107,14 +105,13 @@
setter(c, values[i]);
ast_str_substitute_variables(&str, 0, c, expression);
pbx_substitute_variables_helper(c, expression, workspace, sizeof(workspace));
-
+ ast_test_status_update(test, "Testing '%s' . . . . . %s\n",
+ expression, okay ? "passed" : "FAILED");
if (strcmp(getter(c), ast_str_buffer(str)) != 0 || strcmp(getter(c), workspace) != 0) {
ast_test_status_update(test, "%s != %s != %s\n", getter(c), ast_str_buffer(str), workspace);
okay = 0;
}
}
- ast_test_status_update(test, "Tested '%s' . . . . . %s\n",
- expression, okay ? "passed" : "FAILED");
ast_free(str);
@@ -135,15 +132,14 @@
pbx_builtin_setvar_helper(c, varname, values[i]);
ast_str_substitute_variables(&str, 0, c, ast_str_buffer(var));
pbx_substitute_variables_helper(c, ast_str_buffer(var), workspace, sizeof(workspace));
-
+ ast_test_status_update(test, "Testing '%s' . . . . . %s\n",
+ ast_str_buffer(var), okay ? "passed" : "FAILED");
if (strcmp(values[i], ast_str_buffer(str)) != 0 || strcmp(values[i], workspace) != 0) {
ast_test_status_update(test, "%s != %s != %s\n",
values[i], ast_str_buffer(str), workspace);
okay = 0;
}
}
- ast_test_status_update(test, "Tested '%s' . . . . . %s\n",
- ast_str_buffer(var), okay ? "passed" : "FAILED");
ast_free(str);
ast_free(var);
@@ -160,14 +156,13 @@
ast_str_substitute_variables(&str, 0, c, expression);
pbx_substitute_variables_helper(c, expression, workspace, sizeof(workspace));
-
+ ast_test_status_update(test, "Testing '%s' . . . . . %s\n",
+ expression, okay ? "passed" : "FAILED");
if (strcmp(workspace, ast_str_buffer(str)) != 0) {
- ast_test_status_update(test, "expr: '%s' ... %s != %s\n",
+ ast_test_status_update(test, "test_chan_function, expr: '%s' ... %s != %s\n",
expression, ast_str_buffer(str), workspace);
okay = 0;
}
- ast_test_status_update(test, "Tested '%s' . . . . . %s\n",
- expression, okay ? "passed" : "FAILED");
ast_free(str);
@@ -187,13 +182,15 @@
ast_str_substitute_variables(&str, 0, c, ast_str_buffer(expression));
okay = !strcmp(ast_str_buffer(str), "foobarbaz");
+
+ ast_test_status_update(test, "Testing '%s%s' and '%s%s' . . . . . %s\n",
+ encode1, encode2, decode1, decode2,
+ okay ? "passed" : "FAILED");
+
if (!okay) {
- ast_test_status_update(test, "'%s' != 'foobarbaz'\n",
+ ast_test_status_update(test, " '%s' != 'foobarbaz'\n",
ast_str_buffer(str));
}
- ast_test_status_update(test, "Tested '%s%s' and '%s%s' . . . . . %s\n",
- encode1, encode2, decode1, decode2,
- okay ? "passed" : "FAILED");
ast_free(str);
@@ -207,15 +204,16 @@
int okay;
ast_str_substitute_variables(&str, 0, c, expression);
-
okay = !strcmp(ast_str_buffer(str), result);
+
+ ast_test_status_update(test, "Testing '%s' ('%s') == '%s' . . . . . %s\n",
+ ast_str_buffer(str), expression, result,
+ okay ? "passed" : "FAILED");
+
if (!okay) {
- ast_test_status_update(test, "'%s' != '%s'\n",
+ ast_test_status_update(test, "test_expected_result: '%s' != '%s'\n",
ast_str_buffer(str), result);
}
- ast_test_status_update(test, "Tested '%s' ('%s') == '%s' . . . . . %s\n",
- ast_str_buffer(str), expression, result,
- okay ? "passed" : "FAILED");
ast_free(str);
More information about the asterisk-commits
mailing list