summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6af8978)
raw | patch | inline | side by side (parent: 6af8978)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 22 Jun 2014 12:21:50 +0000 (14:21 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 22 Jun 2014 14:04:18 +0000 (16:04 +0200) |
There's no real use-case for it imho and it's just a weird special case in the
code.
code.
src/core/store_lookup.c | patch | blob | history | |
t/unit/core/store_lookup_test.c | patch | blob | history |
index e6e0a180f9853448d9ea91d0916531fe03d46189..1630d3a2487c956292abf0522561d6d9848e241c 100644 (file)
--- a/src/core/store_lookup.c
+++ b/src/core/store_lookup.c
int status = 0;
assert(m->type == MATCHER_ATTR);
+ assert(ATTR_M(m)->name);
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));
char buf[sdb_data_strlen(&attr->value) + 1];
- if (ATTR_M(m)->name && strcasecmp(ATTR_M(m)->name, SDB_OBJ(attr)->name))
+ if (strcasecmp(ATTR_M(m)->name, SDB_OBJ(attr)->name))
continue;
if (sdb_data_format(&attr->value, buf, sizeof(buf), SDB_UNQUOTED) <= 0)
sdb_store_matcher_t *
sdb_store_attr_matcher(const char *name, const char *value, _Bool re)
{
+ if (! name)
+ return NULL;
+
if (re)
return M(sdb_object_create("attr-matcher", attr_type,
name, NULL, value));
index 918fbef057b75386714d703d1f20157ca7bb877e..c3f3b514a17a0c279582e0c4c3b73bf3900808ee 100644 (file)
int expected;
} golden_data[] = {
- { NULL, NULL, 0, 1 },
- { NULL, NULL, 1, 1 },
{ "k1", NULL, 0, 1 },
{ "k", NULL, 1, 0 },
{ "1", NULL, 1, 0 },
{ "k3", NULL, 1, 0 },
{ "k1", "v1", 0, 1 },
{ "k1", "v1", 1, 1 },
+ { "k1", "^v1$", 1, 1 },
{ "k1", "v", 1, 1 },
{ "k1", "1", 1, 1 },
- { NULL, "v1", 0, 1 },
- { NULL, "^v1$", 1, 1 },
{ "k1", "v2", 0, 0 },
{ "k1", "v2", 1, 0 },
{ "k", "v1", 0, 0 },