[asterisk-dev] [Code Review] Make the parameter separator backward compatible, and error messages more consistent.

Matthew Nicholson mnicholson at digium.com
Mon Dec 8 11:49:31 CST 2008



> On 2008-12-08 11:44:00, Matthew Nicholson wrote:
> > pbx/pbx_lua.c will need to be updated, as it generates arg lists using ',' directly

The following patch should cause the proper behavior.  (I was not sure how to post a patch)


#
# old_revision [05bec77c3806203c46c0300f1f536b982b2faf04]
#
# patch "pbx/pbx_lua.c"
#  from [167b340fb17de36d84612be1650a8e37669eeece]
#    to [d3a8990b20e0965a83586fff9874f2afdadd6083]
#
============================================================
--- pbx/pbx_lua.c	167b340fb17de36d84612be1650a8e37669eeece
+++ pbx/pbx_lua.c	d3a8990b20e0965a83586fff9874f2afdadd6083
@@ -207,9 +207,9 @@ static int lua_pbx_exec(lua_State *L)
 
 		for (i = 3; i <= nargs; i++) {
 			if (lua_isnil(L, i))
-				ast_build_string(&data_next, &data_left, ",");
+				ast_build_string(&data_next, &data_left, AST_STANDARD_APP_DELIM);
 			else
-				ast_build_string(&data_next, &data_left, ",%s", luaL_checkstring(L, i));
+				ast_build_string(&data_next, &data_left, "%s%s", AST_STANDARD_APP_DELIM, luaL_checkstring(L, i));
 		}
 	}
 	
@@ -608,9 +608,9 @@ static int lua_func_read(lua_State *L)
 
 		for (i = 3; i <= nargs; i++) {
 			if (lua_isnil(L, i))
-				ast_build_string(&fullname_next, &fullname_left, ",");
+				ast_build_string(&fullname_next, &fullname_left, AST_STANDARD_APP_DELIM);
 			else
-				ast_build_string(&fullname_next, &fullname_left, ",%s", luaL_checkstring(L, i));
+				ast_build_string(&fullname_next, &fullname_left, "%s%s", AST_STANDARD_APP_DELIM, luaL_checkstring(L, i));
 		}
 	}
 


- Matthew


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/79/#review184
-----------------------------------------------------------


On 2008-12-05 04:11:24, Eliel Sardañons wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/79/
> -----------------------------------------------------------
> 
> (Updated 2008-12-05 04:11:24)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This patch implements an asterisk.conf [compat] option called app_delim, to make applications and functions parameter delimiter backward compatible. if app_delim < 1.5 then, then app/fun delimited should be | (pipe), otherwise it should be "," comma.
> Also there are a number of functions that where not using STANDARD_APP_ARG to parse the app/fun parameters, so, that was changed to use AST_STANDARD_APP_DELIM.
> When printing error messages, we where printing the "syntax" with a hardcoded parameter separator, now the syntax being printed is the one generated with the xml documentation, so the error messages will be consistent with the actual parameter separator, and also with the actual app/fun syntax.
> 
> 
> Diffs
> -----
> 
>   /trunk/Makefile 161114 
>   /trunk/apps/app_dial.c 161114 
>   /trunk/apps/app_macro.c 161114 
>   /trunk/apps/app_meetme.c 161114 
>   /trunk/apps/app_readfile.c 161114 
>   /trunk/funcs/func_callerid.c 161114 
>   /trunk/funcs/func_cut.c 161114 
>   /trunk/funcs/func_env.c 161114 
>   /trunk/funcs/func_realtime.c 161114 
>   /trunk/funcs/func_strings.c 161114 
>   /trunk/include/asterisk/app.h 161114 
>   /trunk/include/asterisk/options.h 161114 
>   /trunk/include/asterisk/pbx.h 161114 
>   /trunk/main/asterisk.c 161114 
>   /trunk/main/pbx.c 161114 
>   /trunk/main/xmldoc.c 161114 
> 
> Diff: http://reviewboard.digium.com/r/79/diff
> 
> 
> Testing
> -------
> 
> Developer testing.
> 
> 
> Thanks,
> 
> Eliel
> 
>




More information about the asterisk-dev mailing list