summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b847762)
raw | patch | inline | side by side (parent: b847762)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 22 Jun 2014 11:28:46 +0000 (13:28 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 22 Jun 2014 11:30:53 +0000 (13:30 +0200) |
src/core/store_lookup.c | patch | blob | history |
index 52739a6a836155fd3ba465a688cb5db222f4aa91..e6e0a180f9853448d9ea91d0916531fe03d46189 100644 (file)
--- a/src/core/store_lookup.c
+++ b/src/core/store_lookup.c
static int
match_string(string_matcher_t *m, const char *name)
{
- assert(m);
-
if ((! m->name) && (! m->name_re))
return 1;
{
int status;
- assert(m && obj);
+ assert((m->type == MATCHER_AND) || (m->type == MATCHER_OR));
assert(OP_M(m)->left && OP_M(m)->right);
status = sdb_store_matcher_matches(OP_M(m)->left, obj);
static int
match_unary(sdb_store_matcher_t *m, sdb_store_base_t *obj)
{
- assert(m && obj);
- assert(UOP_M(m)->op);
-
assert(m->type == MATCHER_NOT);
+ assert(UOP_M(m)->op);
return !sdb_store_matcher_matches(UOP_M(m)->op, obj);
} /* match_unary */
sdb_llist_iter_t *iter = NULL;
int status = 0;
- assert(m && obj);
assert(m->type == MATCHER_NAME);
- if (obj->type != SDB_HOST)
- return 0;
-
switch (NAME_M(m)->obj_type) {
case SDB_HOST:
return match_string(&NAME_M(m)->name, obj->super.name);
sdb_llist_iter_t *iter = NULL;
int status = 0;
- assert(m && obj);
assert(m->type == MATCHER_ATTR);
- if (obj->type != SDB_HOST)
- return 0;
-
iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->attributes);
while (sdb_llist_iter_has_next(iter)) {
sdb_attribute_t *attr = SDB_ATTR(sdb_llist_iter_get_next(iter));
int
sdb_store_matcher_matches(sdb_store_matcher_t *m, sdb_store_base_t *obj)
{
+ if (obj->type != SDB_HOST)
+ return 0;
+
/* "NULL" always matches */
if ((! m) || (! obj))
return 1;