Filter: Removed forgotten dead code

This commit is contained in:
Maria Matejka 2019-08-14 11:31:03 +02:00
parent bf9486bf20
commit 30ba7c1661

View file

@ -185,159 +185,6 @@ f_generate_empty(struct f_dynamic_attr dyn)
return f_new_inst(FI_EA_SET, f_new_inst(FI_CONSTANT, empty), dyn); return f_new_inst(FI_EA_SET, f_new_inst(FI_CONSTANT, empty), dyn);
} }
#if 0
static inline struct f_inst *
f_generate_dpair(struct f_inst *t1, struct f_inst *t2)
{
struct f_inst *rv;
if ((t1->fi_code == FI_CONSTANT) && (t2->fi_code == FI_CONSTANT)) {
if ((t1->val.type != T_INT) || (t2->val.type != T_INT))
cf_error( "Can't operate with value of non-integer type in pair constructor");
check_u16(t1->a[1].i);
check_u16(t2->a[1].i);
rv = f_new_inst(FI_CONSTANT);
rv->val = (struct f_val) {
.type = T_PAIR,
.val.i = pair(t1->a[1].i, t2->a[1].i),
};
}
else {
rv = f_new_inst(FI_PAIR_CONSTRUCT);
rv->a[0].p = t1;
rv->a[1].p = t2;
}
return rv;
}
static inline struct f_inst *
f_generate_ec(u16 kind, struct f_inst *tk, struct f_inst *tv)
{
struct f_inst *rv;
int c1 = 0, c2 = 0, ipv4_used = 0;
u32 key = 0, val2 = 0;
if (tk->fi_code == FI_CONSTANT) {
c1 = 1;
struct f_val *val = &(tk->val);
if (val->type == T_INT) {
ipv4_used = 0; key = val->val.i;
}
else if (tk->val.type == T_QUAD) {
ipv4_used = 1; key = val->val.i;
}
else if ((val->type == T_IP) && ipa_is_ip4(val->val.ip)) {
ipv4_used = 1; key = ipa_to_u32(val->val.ip);
}
else
cf_error("Can't operate with key of non-integer/IPv4 type in EC constructor");
}
if (tv->fi_code == FI_CONSTANT) {
if (tv->val.type != T_INT)
cf_error("Can't operate with value of non-integer type in EC constructor");
c2 = 1;
val2 = tv->val.val.i;
}
if (c1 && c2) {
u64 ec;
if (kind == EC_GENERIC) {
ec = ec_generic(key, val2);
}
else if (ipv4_used) {
check_u16(val2);
ec = ec_ip4(kind, key, val2);
}
else if (key < 0x10000) {
ec = ec_as2(kind, key, val2);
}
else {
check_u16(val2);
ec = ec_as4(kind, key, val2);
}
rv = f_new_inst(FI_CONSTANT);
rv->val = (struct f_val) {
.type = T_EC,
.val.ec = ec,
};
}
else {
rv = f_new_inst(FI_EC_CONSTRUCT);
rv->aux = kind;
rv->a[0].p = tk;
rv->a[1].p = tv;
}
return rv;
}
static inline struct f_inst *
f_generate_lc(struct f_inst *t1, struct f_inst *t2, struct f_inst *t3)
{
struct f_inst *rv;
if ((t1->fi_code == FI_CONSTANT) && (t2->fi_code == FI_CONSTANT) && (t3->fi_code == FI_CONSTANT)) {
if ((t1->val.type != T_INT) || (t2->val.type != T_INT) || (t3->val.type != T_INT))
cf_error( "LC - Can't operate with value of non-integer type in tuple constructor");
rv = f_new_inst(FI_CONSTANT);
rv->val = (struct f_val) {
.type = T_LC,
.val.lc = (lcomm) { t1->a[1].i, t2->a[1].i, t3->a[1].i },
};
}
else
{
rv = f_new_inst(FI_LC_CONSTRUCT);
rv->a[0].p = t1;
rv->a[1].p = t2;
rv->a[2].p = t3;
}
return rv;
}
static inline struct f_inst *
f_generate_path_mask(struct f_inst *t)
{
uint len = 0;
uint dyn = 0;
for (const struct f_inst *tt = t; tt; tt = tt->next) {
if (tt->fi_code != FI_CONSTANT)
dyn++;
len++;
}
if (dyn) {
struct f_inst *pmc = f_new_inst(FI_PATHMASK_CONSTRUCT);
pmc->a[0].p = t;
pmc->a[1].i = len;
return pmc;
}
struct f_path_mask *pm = cfg_allocz(sizeof(struct f_path_mask) + len * sizeof(struct f_path_mask_item));
uint i = 0;
for (const struct f_inst *tt = t; tt; tt = tt->next)
pm->item[i++] = tt->val.val.pmi;
pm->len = i;
struct f_inst *pmc = f_new_inst(FI_CONSTANT);
pmc->val = (struct f_val) { .type = T_PATH_MASK, .val.path_mask = pm, };
return pmc;
}
#endif
/* /*
* Remove all new lines and doubled whitespaces * Remove all new lines and doubled whitespaces
* and convert all tabulators to spaces * and convert all tabulators to spaces