tmp_attrs fixed.

I do not know if it is right since mj ingores talk once started :-(.
This commit is contained in:
Pavel Machek 2000-03-01 14:31:31 +00:00
parent 4ebbbd4079
commit 31e79264a2
3 changed files with 23 additions and 13 deletions

View file

@ -424,7 +424,7 @@ cmd:
} }
| UNSET '(' rtadot dynamic_attr ')' ';' { | UNSET '(' rtadot dynamic_attr ')' ';' {
$$ = $4; $$ = $4;
$$->aux = T_VOID; $$->aux = EAF_TYPE_UNDEF | EAF_INLINE;
$$->code = P('e','S'); $$->code = P('e','S');
$$->a1.p = NULL; $$->a1.p = NULL;
} }

View file

@ -36,7 +36,7 @@ struct f_inst *
f_new_dynamic_attr(int code) f_new_dynamic_attr(int code)
{ {
struct f_inst *f = f_new_inst(); struct f_inst *f = f_new_inst();
f->aux = T_INT; f->aux = EAF_TYPE_INT | EAF_INLINE;
f->a2.i = code; f->a2.i = code;
return f; return f;
} }

View file

@ -142,6 +142,7 @@ val_print(struct f_val v)
static struct rte **f_rte, *f_rte_old; static struct rte **f_rte, *f_rte_old;
static struct linpool *f_pool; static struct linpool *f_pool;
static struct ea_list **f_tmp_attrs;
#define runtime(x) do { \ #define runtime(x) do { \
log( L_ERR x ); \ log( L_ERR x ); \
@ -319,7 +320,8 @@ interpret(struct f_inst *what)
case P('e','a'): /* Access to extended attributes */ case P('e','a'): /* Access to extended attributes */
{ {
eattr *e = ea_find( (*f_rte)->attrs->eattrs, what->a2.i ); eattr *e = ea_find( (*f_rte)->attrs->eattrs, what->a2.i );
/* FIXME: should I search in tmp_attrs, too, or what ? */ if (!e)
e = ea_find( (*f_tmp_attrs), what->a2.i );
if (!e) { if (!e) {
res.type = T_VOID; res.type = T_VOID;
break; break;
@ -345,19 +347,28 @@ interpret(struct f_inst *what)
l->count = 1; l->count = 1;
l->attrs[0].id = what->a2.i; l->attrs[0].id = what->a2.i;
l->attrs[0].flags = 0; l->attrs[0].flags = 0;
switch (what->aux) { l->attrs[0].type = what->aux;
case T_INT: switch (what->aux & EAF_TYPE_MASK) {
l->attrs[0].type = EAF_TYPE_INT | EAF_INLINE; case EAF_TYPE_INT:
if (v1.type != T_INT)
runtime( "Setting int attribute to non-int value" );
l->attrs[0].u.data = v1.val.i; l->attrs[0].u.data = v1.val.i;
break; break;
case T_VOID: case EAF_TYPE_UNDEF:
l->attrs[0].type = EAF_TYPE_UNDEF | EAF_INLINE; if (v1.type != T_VOID)
runtime( "Setting void attribute to non-void value" );
l->attrs[0].u.data = 0; l->attrs[0].u.data = 0;
break; break;
} }
if (what->aux & EAF_INLINE) {
*f_rte = rte_do_cow(*f_rte); *f_rte = rte_do_cow(*f_rte);
l->next = (*f_rte)->attrs->eattrs; l->next = (*f_rte)->attrs->eattrs;
(*f_rte)->attrs->eattrs = l; (*f_rte)->attrs->eattrs = l;
} else {
l->next = (*f_tmp_attrs);
(*f_tmp_attrs) = l;
}
} }
break; break;
@ -494,8 +505,6 @@ i_same(struct f_inst *f1, struct f_inst *f2)
return i_same(f1->next, f2->next); return i_same(f1->next, f2->next);
} }
/* FIXME: tmp_attrs is unreferenced. That can't be right.
Strange. look at eS how dynamic attrs are set. */
int int
f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool) f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool)
{ {
@ -503,6 +512,7 @@ f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struc
struct f_val res; struct f_val res;
debug( "Running filter `%s'...", filter->name ); debug( "Running filter `%s'...", filter->name );
f_tmp_attrs = tmp_attrs;
f_rte = rte; f_rte = rte;
f_rte_old = *rte; f_rte_old = *rte;
f_pool = tmp_pool; f_pool = tmp_pool;