summaryrefslogtreecommitdiff
path: root/filter/data.h
diff options
context:
space:
mode:
authorAlexander Zubkov <green@qrator.net>2022-03-04 14:07:58 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2022-06-27 21:13:31 +0200
commitb2d6d2948af268812a8f55f260d340194eb3f7ac (patch)
tree4d1d4d3b91776e4aafcee83b5c4a3144425fe2aa /filter/data.h
parent8f3c6151b4ff11d98a20f6f9919723f0fb719161 (diff)
Filter: Add literal for empty set
Add literal for empty set [], which works both for tree-based sets and prefix sets by using existing constant promotion mechanism. Minor changes by committer.
Diffstat (limited to 'filter/data.h')
-rw-r--r--filter/data.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/filter/data.h b/filter/data.h
index 8cba8c0e..221e4229 100644
--- a/filter/data.h
+++ b/filter/data.h
@@ -279,11 +279,11 @@ int val_in_range(const struct f_val *v1, const struct f_val *v2);
int clist_set_type(const struct f_tree *set, struct f_val *v);
static inline int eclist_set_type(const struct f_tree *set)
-{ return set->from.type == T_EC; }
+{ return !set || set->from.type == T_EC; }
static inline int lclist_set_type(const struct f_tree *set)
-{ return set->from.type == T_LC; }
+{ return !set || set->from.type == T_LC; }
static inline int path_set_type(const struct f_tree *set)
-{ return set->from.type == T_INT; }
+{ return !set || set->from.type == T_INT; }
const struct adata *clist_filter(struct linpool *pool, const struct adata *list, const struct f_val *set, int pos);
const struct adata *eclist_filter(struct linpool *pool, const struct adata *list, const struct f_val *set, int pos);
@@ -299,7 +299,7 @@ undef_value(struct f_val v)
(v.val.ad == &null_adata);
}
-extern const struct f_val f_const_empty_path, f_const_empty_clist, f_const_empty_eclist, f_const_empty_lclist;
+extern const struct f_val f_const_empty_path, f_const_empty_clist, f_const_empty_eclist, f_const_empty_lclist, f_const_empty_prefix_set;
enum filter_return f_eval(const struct f_line *expr, struct linpool *tmp_pool, struct f_val *pres);