summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c603d51)
raw | patch | inline | side by side (parent: c603d51)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 19 May 2015 20:28:49 +0000 (22:28 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 19 May 2015 20:28:49 +0000 (22:28 +0200) |
In the AST world, this is NOT(IS-NULL).
src/core/store-private.h | patch | blob | history | |
src/core/store_lookup.c | patch | blob | history | |
src/include/core/store.h | patch | blob | history | |
t/unit/core/store_lookup_test.c | patch | blob | history |
index dfa3e845d13e330101c86f59e0d03598bb2ee351..1342a5b58fca93508d93f00571753be9b7e3d5db 100644 (file)
--- a/src/core/store-private.h
+++ b/src/core/store-private.h
/* unary operators */
MATCHER_ISNULL,
- MATCHER_ISNNULL,
/* ary operators */
MATCHER_LT,
: ((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) ? "=" \
index 4862905b3366d4fa4455a95ddc80a5bedd8ee652..f72e26dd4e6f4e153ebc2728c4f0b5d067e4fd4d 100644 (file)
--- a/src/core/store_lookup.c
+++ b/src/core/store_lookup.c
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;
if (ISNULL_M(m)->expr->type)
sdb_data_free_datum(&v);
- if (m->type == MATCHER_ISNNULL)
- return !status;
return status;
} /* match_isnull */
/* unary operators */
match_isnull,
- match_isnull,
/* ary operators */
match_cmp,
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 *);
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)
{
index 48866a7df79e1d3835daf89ccf65e3c46353e4fb..f2235571cd8f0f7d080cd1c7795482c184e886d0 100644 (file)
--- a/src/include/core/store.h
+++ b/src/include/core/store.h
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
index 4466b153c93b557285a908bd2872044f5133a548..14d2209a933e0e398a620532a419fae0c27e0e19 100644 (file)
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;