diff options
author | Maria Matejka <mq@ucw.cz> | 2022-04-14 18:32:19 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-05-04 15:38:40 +0200 |
commit | cf07d8ad79273a3bbf0617c17e438602e4b64ece (patch) | |
tree | f747ced6c101d48032e1f0185d0340b5fb3d69f3 /filter | |
parent | 1d309c4ce6e95b68c64a8f007f6dd2f1830a5707 (diff) |
Replaced boilerplate eattr allocation by ea_set_attr()
Diffstat (limited to 'filter')
-rw-r--r-- | filter/f-inst.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/filter/f-inst.c b/filter/f-inst.c index 0d042e37..7b34ef91 100644 --- a/filter/f-inst.c +++ b/filter/f-inst.c @@ -696,21 +696,13 @@ DYNAMIC_ATTR; ARG_TYPE(1, da.type); { - struct ea_list *l = tmp_alloc(sizeof(struct ea_list) + sizeof(eattr)); - - l->next = NULL; - l->flags = EALF_SORTED; - l->count = 1; - l->attrs[0].id = da.ea_code; - l->attrs[0].flags = 0; - l->attrs[0].type = da.type; - l->attrs[0].originated = 1; - l->attrs[0].fresh = 1; - l->attrs[0].undef = 0; + struct eattr *a; if (da.type >= EAF_TYPE__MAX) bug("Unsupported attribute type"); + f_rta_cow(fs); + switch (da.type) { case T_OPAQUE: case T_IFACE: @@ -718,18 +710,18 @@ break; case T_IP: - l->attrs[0].u.ptr = tmp_store_adata(&v1.val.ip, sizeof(ip_addr)); + a = ea_set_attr(fs->eattrs, + EA_LITERAL_STORE_ADATA(da.ea_code, da.type, 0, &v1.val.ip, sizeof(ip_addr))); break; default: - l->attrs[0].u = v1.val.bval; + a = ea_set_attr(fs->eattrs, + EA_LITERAL_GENERIC(da.ea_code, da.type, 0, .u = v1.val.bval)); break; - } - f_rta_cow(fs); - l->next = *fs->eattrs; - *fs->eattrs = l; + a->originated = 1; + a->fresh = 1; } } |