[asterisk-commits] trunk r10209 - /trunk/pbx.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Feb 15 11:39:55 MST 2006
Author: russell
Date: Wed Feb 15 12:39:52 2006
New Revision: 10209
URL: http://svn.digium.com/view/asterisk?rev=10209&view=rev
Log:
Fix the retrieval of the new SYSTEMNAME variable. Also, clarify some
documentation of how pbx_retrieve_variable works. (issue #6493)
Modified:
trunk/pbx.c
Modified: trunk/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx.c?rev=10209&r1=10208&r2=10209&view=diff
==============================================================================
--- trunk/pbx.c (original)
+++ trunk/pbx.c Wed Feb 15 12:39:52 2006
@@ -909,13 +909,18 @@
/*
* Look first into predefined variables, then into variable lists.
+ * Variable 's' points to the result, according to the following rules:
* s == ¬_found (set at the beginning) means that we did not find a
- * matching variable and need to look into more places.
+ * matching variable and need to look into more places.
* If s != ¬_found, s is a valid result string as follows:
* s = NULL if the variable does not have a value;
+ * you typically do this when looking for an unset predefined variable.
* s = workspace if the result has been assembled there;
+ * typically done when the result is built e.g. with an snprintf(),
+ * so we don't need to do an additional copy.
* s != workspace in case we have a string, that needs to be copied
* (the ast_copy_string is done once for all at the end).
+ * Typically done when the result is already available in some string.
*/
s = ¬_found; /* default value */
if (c) { /* This group requires a valid channel */
@@ -961,7 +966,7 @@
snprintf(workspace, workspacelen, "%u",(int)time(NULL));
s = workspace;
} else if (!strcmp(var, "SYSTEMNAME")) {
- ast_copy_string(workspace, ast_config_AST_SYSTEM_NAME, workspacelen);
+ s = ast_config_AST_SYSTEM_NAME;
}
}
/* if not found, look into chanvars or global vars */
More information about the asterisk-commits
mailing list