make destroy_pval able to handle a NULL value

(the warning should be removed);
define a 'elements_block' rule to simplify some other rules
removing duplicated code - runtests seems happy with this.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23613 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Luigi Rizzo 19 years ago
parent ce05a548c3
commit f4b05f86cc

File diff suppressed because it is too large Load Diff

@ -116,6 +116,7 @@ static pval *update_last(pval *, YYLTYPE *);
%type <pval>file
/* XXX lr changes */
%type <pval>opt_else
%type <pval>elements_block
%type <str>opt_word
%type <str>word_or_default
@ -159,6 +160,7 @@ static pval *update_last(pval *, YYLTYPE *);
ignorepat element elements arglist global_statement
global_statements globals macro context object objects
opt_else
elements_block
%destructor { free($$);} word word_list goto_word word3_list includedname opt_word word_or_default
@ -193,21 +195,14 @@ word_or_default : word { $$ = $1; }
| KW_DEFAULT { $$ = strdup("default"); }
;
context : KW_CONTEXT word_or_default LC elements RC {
$$ = npval2(PV_CONTEXT, &@1, &@5);
context : KW_CONTEXT word_or_default elements_block {
$$ = npval2(PV_CONTEXT, &@1, &@3);
$$->u1.str = $2;
$$->u2.statements = $4; }
| KW_CONTEXT word_or_default LC RC /* empty context OK */ {
$$->u2.statements = $3; }
| KW_ABSTRACT KW_CONTEXT word_or_default elements_block {
$$ = npval2(PV_CONTEXT, &@1, &@4);
$$->u1.str = $2; }
| KW_ABSTRACT KW_CONTEXT word_or_default LC elements RC {
$$ = npval2(PV_CONTEXT, &@1, &@6);
$$->u1.str = $3;
$$->u2.statements = $5;
$$->u3.abstract = 1; }
| KW_ABSTRACT KW_CONTEXT word_or_default LC RC /* empty context OK */ {
$$ = npval2(PV_CONTEXT, &@1, &@5);
$$->u1.str = $3;
$$->u2.statements = $4;
$$->u3.abstract = 1; }
;
@ -254,6 +249,10 @@ arglist : word {
| arglist error {$$=$1;}
;
elements_block : LC RC { $$ = NULL; }
| LC elements RC { $$ = $2; }
;
elements : element { $$=$1;}
| error {$$=0;}
| elements element { if ( $1 && $2 ) {$$=$1; linku1($$,$2);}

@ -3554,6 +3554,11 @@ STD_MOD(MOD_1 | NO_USECOUNT, reload, NULL, NULL);
void destroy_pval_item(pval *item)
{
if (item == NULL) {
ast_log(LOG_WARNING, "null item\n");
return;
}
if (item->filename)
free(item->filename);

Loading…
Cancel
Save