1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Filter: Use common initializer for undefined variables and eattrs.

Undefined paths and clists should use typed f_val with empty adata
instead of just void f_val. Use common initializer to handle both
variables and eattrs.
This commit is contained in:
Ondrej Zajicek
2023-09-13 06:21:26 +02:00
parent 7395b97daf
commit a3dc26455d
3 changed files with 28 additions and 51 deletions

View File

@@ -318,14 +318,32 @@ const struct adata *lclist_filter(struct linpool *pool, const struct adata *list
/* Special undef value for paths and clists */
static inline int
undef_value(struct f_val v)
val_is_undefined(struct f_val v)
{
return ((v.type == T_PATH) || (v.type == T_CLIST) ||
(v.type == T_ECLIST) || (v.type == T_LCLIST)) &&
(v.val.ad == &null_adata);
}
static inline struct f_val
val_empty(enum f_type t)
{
switch (t)
{
case T_PATH:
case T_CLIST:
case T_ECLIST:
case T_LCLIST:
return (struct f_val) { .type = t, .val.ad = &null_adata };
default:
return (struct f_val) { };
}
}
extern const struct f_val f_const_empty_prefix_set;
enum filter_return f_eval(const struct f_line *expr, struct linpool *tmp_pool, struct f_val *pres);