From: Sebastian Harl Date: Tue, 19 May 2015 20:28:49 +0000 (+0200) Subject: store: Drop the special IS-NOT-NULL matcher. X-Git-Tag: sysdb-0.8.0~82 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=d8d03b18f0e0a4c39e2adec3cc2cd093d52c1f93 store: Drop the special IS-NOT-NULL matcher. In the AST world, this is NOT(IS-NULL). --- diff --git a/src/core/store-private.h b/src/core/store-private.h index dfa3e84..1342a5b 100644 --- a/src/core/store-private.h +++ b/src/core/store-private.h @@ -164,7 +164,6 @@ enum { /* unary operators */ MATCHER_ISNULL, - MATCHER_ISNNULL, /* ary operators */ MATCHER_LT, @@ -189,7 +188,6 @@ enum { : ((t) == MATCHER_IN) ? "IN" \ : ((t) == MATCHER_NIN) ? "NOT IN" \ : ((t) == MATCHER_ISNULL) ? "IS NULL" \ - : ((t) == MATCHER_ISNNULL) ? "IS NOT NULL" \ : ((t) == MATCHER_LT) ? "<" \ : ((t) == MATCHER_LE) ? "<=" \ : ((t) == MATCHER_EQ) ? "=" \ diff --git a/src/core/store_lookup.c b/src/core/store_lookup.c index 4862905..f72e26d 100644 --- a/src/core/store_lookup.c +++ b/src/core/store_lookup.c @@ -301,7 +301,7 @@ match_isnull(sdb_store_matcher_t *m, sdb_store_obj_t *obj, sdb_data_t v = SDB_DATA_INIT; int status; - assert((m->type == MATCHER_ISNULL) || (m->type == MATCHER_ISNNULL)); + assert(m->type == MATCHER_ISNULL); if (ISNULL_M(m)->expr->type) { /* TODO: this might hide real errors; @@ -319,8 +319,6 @@ match_isnull(sdb_store_matcher_t *m, sdb_store_obj_t *obj, if (ISNULL_M(m)->expr->type) sdb_data_free_datum(&v); - if (m->type == MATCHER_ISNNULL) - return !status; return status; } /* match_isnull */ @@ -341,7 +339,6 @@ matchers[] = { /* unary operators */ match_isnull, - match_isnull, /* ary operators */ match_cmp, @@ -456,7 +453,7 @@ static int isnull_matcher_init(sdb_object_t *obj, va_list ap) { M(obj)->type = va_arg(ap, int); - if ((M(obj)->type != MATCHER_ISNULL) && (M(obj)->type != MATCHER_ISNNULL)) + if (M(obj)->type != MATCHER_ISNULL) return -1; ISNULL_M(obj)->expr = va_arg(ap, sdb_store_expr_t *); @@ -637,13 +634,6 @@ sdb_store_isnull_matcher(sdb_store_expr_t *expr) MATCHER_ISNULL, expr)); } /* sdb_store_isnull_matcher */ -sdb_store_matcher_t * -sdb_store_isnnull_matcher(sdb_store_expr_t *expr) -{ - return M(sdb_object_create("isnull-matcher", isnull_type, - MATCHER_ISNNULL, expr)); -} /* sdb_store_isnnull_matcher */ - sdb_store_matcher_op_cb sdb_store_parse_matcher_op(const char *op) { diff --git a/src/include/core/store.h b/src/include/core/store.h index 48866a7..f223557 100644 --- a/src/include/core/store.h +++ b/src/include/core/store.h @@ -624,13 +624,6 @@ sdb_store_nregex_matcher(sdb_store_expr_t *left, sdb_store_expr_t *right); sdb_store_matcher_t * sdb_store_isnull_matcher(sdb_store_expr_t *expr); -/* - * sdb_store_isnnull_matcher: - * Creates a matcher matching non-NULL values. - */ -sdb_store_matcher_t * -sdb_store_isnnull_matcher(sdb_store_expr_t *expr); - /* * sdb_store_matcher_matches: * Check whether the specified matcher matches the specified store object. If diff --git a/t/unit/core/store_lookup_test.c b/t/unit/core/store_lookup_test.c index 4466b15..14d2209 100644 --- a/t/unit/core/store_lookup_test.c +++ b/t/unit/core/store_lookup_test.c @@ -427,8 +427,8 @@ START_TEST(test_store_match_op) sdb_data_t d = { SDB_TYPE_STRING, { .string = "a" } }; sdb_store_expr_t *e = sdb_store_expr_constvalue(&d); - sdb_store_matcher_t *always = sdb_store_isnnull_matcher(e); sdb_store_matcher_t *never = sdb_store_isnull_matcher(e); + sdb_store_matcher_t *always = sdb_store_inv_matcher(never); struct { const char *op;