Cleaned up mess with types in e,a and e,S. Dynamic attributes should

now work.
This commit is contained in:
Pavel Machek 2000-04-17 14:12:02 +00:00
parent 74a7da482b
commit 0150e5211a
2 changed files with 11 additions and 9 deletions

View file

@ -24,7 +24,7 @@ struct f_inst *
f_new_dynamic_attr(int type, int f_type, int code) f_new_dynamic_attr(int type, int f_type, int code)
{ {
struct f_inst *f = f_new_inst(); struct f_inst *f = f_new_inst();
f->aux = f_type; f->aux = type;
f->a2.i = code; f->a2.i = code;
return f; return f;
} }

View file

@ -353,13 +353,17 @@ interpret(struct f_inst *what)
res.type = T_VOID; res.type = T_VOID;
break; break;
} }
res.type = what->aux; /* FIXME: should check type? */ switch (what->aux & EAF_TYPE_MASK) {
switch (what->aux) { case EAF_TYPE_INT:
case T_INT: res.type = T_INT;
res.val.i = e->u.data; res.val.i = e->u.data;
break; break;
case T_CLIST: case EAF_TYPE_AS_PATH:
case T_PATH: res.type = T_PATH;
res.val.ad = e->u.ptr;
break;
case EAF_TYPE_INT_SET:
res.type = T_CLIST;
res.val.ad = e->u.ptr; res.val.ad = e->u.ptr;
break; break;
default: default:
@ -369,9 +373,6 @@ interpret(struct f_inst *what)
break; break;
case P('e','S'): case P('e','S'):
ONEARG; ONEARG;
if (v1.type != what->aux)
runtime("Wrong type when setting dynamic attribute");
{ {
struct ea_list *l = lp_alloc(f_pool, sizeof(struct ea_list) + sizeof(eattr)); struct ea_list *l = lp_alloc(f_pool, sizeof(struct ea_list) + sizeof(eattr));
@ -402,6 +403,7 @@ interpret(struct f_inst *what)
runtime( "Setting void attribute to non-void value" ); runtime( "Setting void attribute to non-void value" );
l->attrs[0].u.data = 0; l->attrs[0].u.data = 0;
break; break;
default: bug("Unknown type in e,S");
} }
if (!(what->aux & EAF_TEMP) && (!(f_flags & FF_FORCE_TMPATTR))) { if (!(what->aux & EAF_TEMP) && (!(f_flags & FF_FORCE_TMPATTR))) {