aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-03 18:47:48 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-02-03 18:47:48 +0000
commitd939de1b4fa5c319f0761dba72598472def0b09d (patch)
treef6a2541d63548b7b74e81116fb353dd009067bc4
parentc2dd998774578b04561c92e90676245f721f128c (diff)
Merged revisions 244505 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r244505 | tilghman | 2010-02-03 12:34:29 -0600 (Wed, 03 Feb 2010) | 8 lines The chanvar= setting should inherit the entire list of variables, not just the first one. (closes issue #16359) Reported by: raarts Patches: dahdi-setvars.diff uploaded by raarts (license 937) Tested by: raarts ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@244508 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_dahdi.c8
-rw-r--r--main/ast_expr2f.c134
2 files changed, 83 insertions, 59 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 9718bcd26..853fc8fb7 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -10517,7 +10517,13 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
tmp->callgroup = conf->chan.callgroup;
tmp->pickupgroup= conf->chan.pickupgroup;
if (conf->chan.vars) {
- tmp->vars = ast_variable_new(conf->chan.vars->name, conf->chan.vars->value, "");
+ struct ast_variable *v, *tmpvar;
+ for (v = conf->chan.vars ; v ; v = v->next) {
+ if ((tmpvar = ast_variable_new(v->name, v->value, v->file))) {
+ tmpvar->next = tmp->vars;
+ tmp->vars = tmpvar;
+ }
+ }
}
tmp->cid_rxgain = conf->chan.cid_rxgain;
tmp->rxgain = conf->chan.rxgain;
diff --git a/main/ast_expr2f.c b/main/ast_expr2f.c
index 15020a60c..543369707 100644
--- a/main/ast_expr2f.c
+++ b/main/ast_expr2f.c
@@ -11,7 +11,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 34
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -56,6 +56,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -86,8 +87,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
-#endif /* ! C99 */
-
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -195,6 +194,13 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ * Given that the standard has decreed that size_t exists since 1989,
+ * I guess we can afford to depend on it. Manoj.
+ */
+
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
@@ -551,6 +557,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/channel.h"
#endif
+/*!\note The latest Flex uses fwrite without checking its return value, which
+ * is a warning on some compilers. Therefore, we use this workaround, to trick
+ * the compiler into suppressing this warning. */
+#define fwrite(a,b,c,d) do { int __res = fwrite(a,b,c,d); (__res); } while (0)
+
enum valtype {
AST_EXPR_number, AST_EXPR_numeric_string, AST_EXPR_string
} ;
@@ -596,7 +607,7 @@ int ast_yyget_column(yyscan_t yyscanner);
static int curlycount = 0;
static char *expr2_token_subst(const char *mess);
-#line 598 "ast_expr2f.c"
+#line 609 "ast_expr2f.c"
#define INITIAL 0
#define var 1
@@ -743,7 +754,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -754,7 +765,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- size_t n; \
+ int n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -839,10 +850,10 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 125 "ast_expr2.fl"
+#line 130 "ast_expr2.fl"
-#line 844 "ast_expr2f.c"
+#line 855 "ast_expr2f.c"
yylval = yylval_param;
@@ -933,132 +944,132 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 127 "ast_expr2.fl"
+#line 132 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_OR;}
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 128 "ast_expr2.fl"
+#line 133 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_AND;}
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 129 "ast_expr2.fl"
+#line 134 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_EQ;}
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 130 "ast_expr2.fl"
+#line 135 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_OR;}
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 131 "ast_expr2.fl"
+#line 136 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_AND;}
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 132 "ast_expr2.fl"
+#line 137 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_EQ;}
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 133 "ast_expr2.fl"
+#line 138 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_EQTILDE;}
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 134 "ast_expr2.fl"
+#line 139 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_TILDETILDE;}
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 135 "ast_expr2.fl"
+#line 140 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_GT;}
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 136 "ast_expr2.fl"
+#line 141 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_LT;}
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 137 "ast_expr2.fl"
+#line 142 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_GE;}
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 138 "ast_expr2.fl"
+#line 143 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_LE;}
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 139 "ast_expr2.fl"
+#line 144 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_NE;}
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 140 "ast_expr2.fl"
+#line 145 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_PLUS;}
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 141 "ast_expr2.fl"
+#line 146 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_COMMA;}
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 142 "ast_expr2.fl"
+#line 147 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_MINUS;}
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 143 "ast_expr2.fl"
+#line 148 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_MULT;}
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 144 "ast_expr2.fl"
+#line 149 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_DIV;}
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 145 "ast_expr2.fl"
+#line 150 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_MOD;}
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 146 "ast_expr2.fl"
+#line 151 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_COND;}
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 147 "ast_expr2.fl"
+#line 152 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_COMPL;}
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 148 "ast_expr2.fl"
+#line 153 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_COLON;}
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 149 "ast_expr2.fl"
+#line 154 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_COLONCOLON;}
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 150 "ast_expr2.fl"
+#line 155 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_LP;}
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 151 "ast_expr2.fl"
+#line 156 "ast_expr2.fl"
{ SET_COLUMNS; SET_STRING; return TOK_RP;}
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 152 "ast_expr2.fl"
+#line 157 "ast_expr2.fl"
{
/* gather the contents of ${} expressions, with trailing stuff,
* into a single TOKEN.
@@ -1071,24 +1082,24 @@ YY_RULE_SETUP
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 162 "ast_expr2.fl"
+#line 167 "ast_expr2.fl"
{}
YY_BREAK
case 28:
/* rule 28 can match eol */
YY_RULE_SETUP
-#line 163 "ast_expr2.fl"
+#line 168 "ast_expr2.fl"
{SET_COLUMNS; SET_STRING; return TOKEN;}
YY_BREAK
case 29:
/* rule 29 can match eol */
YY_RULE_SETUP
-#line 165 "ast_expr2.fl"
+#line 170 "ast_expr2.fl"
{/* what to do with eol */}
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 166 "ast_expr2.fl"
+#line 171 "ast_expr2.fl"
{
SET_COLUMNS;
/* the original behavior of the expression parser was
@@ -1101,7 +1112,7 @@ YY_RULE_SETUP
case 31:
/* rule 31 can match eol */
YY_RULE_SETUP
-#line 175 "ast_expr2.fl"
+#line 180 "ast_expr2.fl"
{
SET_COLUMNS;
SET_STRING;
@@ -1111,7 +1122,7 @@ YY_RULE_SETUP
case 32:
/* rule 32 can match eol */
YY_RULE_SETUP
-#line 181 "ast_expr2.fl"
+#line 186 "ast_expr2.fl"
{
curlycount = 0;
BEGIN(var);
@@ -1121,7 +1132,7 @@ YY_RULE_SETUP
case 33:
/* rule 33 can match eol */
YY_RULE_SETUP
-#line 187 "ast_expr2.fl"
+#line 192 "ast_expr2.fl"
{
curlycount--;
if (curlycount < 0) {
@@ -1135,7 +1146,7 @@ YY_RULE_SETUP
case 34:
/* rule 34 can match eol */
YY_RULE_SETUP
-#line 197 "ast_expr2.fl"
+#line 202 "ast_expr2.fl"
{
curlycount++;
yymore();
@@ -1143,7 +1154,7 @@ YY_RULE_SETUP
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 203 "ast_expr2.fl"
+#line 208 "ast_expr2.fl"
{
BEGIN(0);
SET_COLUMNS;
@@ -1153,7 +1164,7 @@ YY_RULE_SETUP
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 210 "ast_expr2.fl"
+#line 215 "ast_expr2.fl"
{
curlycount = 0;
BEGIN(var);
@@ -1163,7 +1174,7 @@ YY_RULE_SETUP
case 37:
/* rule 37 can match eol */
YY_RULE_SETUP
-#line 216 "ast_expr2.fl"
+#line 221 "ast_expr2.fl"
{
char c = yytext[yyleng-1];
BEGIN(0);
@@ -1174,7 +1185,7 @@ YY_RULE_SETUP
}
YY_BREAK
case YY_STATE_EOF(trail):
-#line 225 "ast_expr2.fl"
+#line 230 "ast_expr2.fl"
{
BEGIN(0);
SET_COLUMNS;
@@ -1185,10 +1196,10 @@ case YY_STATE_EOF(trail):
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 233 "ast_expr2.fl"
+#line 238 "ast_expr2.fl"
ECHO;
YY_BREAK
-#line 1190 "ast_expr2f.c"
+#line 1201 "ast_expr2f.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(var):
yyterminate();
@@ -1962,8 +1973,8 @@ YY_BUFFER_STATE ast_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
/** Setup the input buffer state to scan the given bytes. The next call to ast_yylex() will
* scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
@@ -2124,7 +2135,7 @@ void ast_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param column_no
+ * @param line_number
* @param yyscanner The scanner object.
*/
void ast_yyset_column (int column_no , yyscan_t yyscanner)
@@ -2364,7 +2375,7 @@ void *ast_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 233 "ast_expr2.fl"
+#line 238 "ast_expr2.fl"
@@ -2379,20 +2390,27 @@ int ast_yyerror(const char *, YYLTYPE *, struct parse_io *); /* likewise */
void ast_yyfree(void *ptr, yyscan_t yyscanner)
{
- /* the normal generated ast_yyfree func just frees its first arg;
- this get complaints on some systems, as sometimes this
- arg is a nil ptr! It's usually not fatal, but is irritating! */
- free( (char *) ptr );
+ /* the normal generated ast_yyfree func just frees its first arg;
+ this get complaints on some systems, as sometimes this
+ arg is a nil ptr! It's usually not fatal, but is irritating! */
+ free( (char *) ptr );
}
int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
{
- struct parse_io io = { .string = expr, .chan = chan };
+ struct parse_io io;
int return_value = 0;
-
+
+ memset(&io, 0, sizeof(io));
+ io.string = expr; /* to pass to the error routine */
+ io.chan = chan;
+
ast_yylex_init(&io.scanner);
+
ast_yy_scan_string(expr, io.scanner);
+
ast_yyparse ((void *) &io);
+
ast_yylex_destroy(io.scanner);
if (!io.val) {