summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7d659a7)
raw | patch | inline | side by side (parent: 7d659a7)
author | Florian Forster <ff@octo.it> | |
Sat, 26 Jun 2010 10:31:23 +0000 (12:31 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 26 Jun 2010 10:31:23 +0000 (12:31 +0200) |
src/graph.c | patch | blob | history | |
src/graph_ident.c | patch | blob | history | |
src/graph_instance.c | patch | blob | history | |
src/graph_instance.h | patch | blob | history |
diff --git a/src/graph.c b/src/graph.c
index 0802bee4306f70775e6f7ac34f9fbdb1d8fbe407..01f0791dfa8ac7ea7fd761ced83c3070216fde45 100644 (file)
--- a/src/graph.c
+++ b/src/graph.c
return (NULL);
for (i = 0; i < cfg->instances_num; i++)
- if (inst_matches_ident (cfg->instances[i], ident))
+ if (inst_ident_matches (cfg->instances[i], ident))
return (cfg->instances[i]);
return (NULL);
diff --git a/src/graph_ident.c b/src/graph_ident.c
index cb9a3618fb30d19bf87ca183ee60233db296bda4..36e066d15dc85792fed5a54d470459beeb63fe91 100644 (file)
--- a/src/graph_ident.c
+++ b/src/graph_ident.c
_Bool ident_matches (const graph_ident_t *selector, /* {{{ */
const graph_ident_t *ident)
{
- if ((selector == NULL) && (ident == NULL))
+ if ((selector == NULL) || (ident == NULL))
return (0);
- else if (selector == NULL)
- return (-1);
- else if (ident == NULL)
- return (1);
if (!part_matches (selector->host, ident->host))
return (0);
diff --git a/src/graph_instance.c b/src/graph_instance.c
index 2d12873e7624b037852bc40e685ed7ff2b0bb711..5431589cfa9f4ed4f1c3074c8734f0065f8cc7be 100644 (file)
--- a/src/graph_instance.c
+++ b/src/graph_instance.c
return (ident_compare (inst->select, ident));
} /* }}} int inst_compare_ident */
-_Bool inst_matches_ident (graph_instance_t *inst, /* {{{ */
+_Bool inst_ident_matches (graph_instance_t *inst, /* {{{ */
const graph_ident_t *ident)
{
if ((inst == NULL) || (ident == NULL))
return (0);
return (ident_matches (inst->select, ident));
+} /* }}} _Bool inst_ident_matches */
+
+_Bool inst_matches_ident (graph_instance_t *inst, /* {{{ */
+ const graph_ident_t *ident)
+{
+ if ((inst == NULL) || (ident == NULL))
+ return (0);
+
+ return (ident_matches (ident, inst->select));
} /* }}} _Bool inst_matches_ident */
_Bool inst_matches_string (graph_config_t *cfg, /* {{{ */
diff --git a/src/graph_instance.h b/src/graph_instance.h
index a6e7462163e5aae3dd47f6ca12bfbdd912816778..fa08dcdae86a86bca3e7012460c5bb251f041a46 100644 (file)
--- a/src/graph_instance.h
+++ b/src/graph_instance.h
int inst_compare_ident (graph_instance_t *inst, const graph_ident_t *ident);
-_Bool inst_matches_ident (graph_instance_t *inst, const graph_ident_t *ident);
+/* Returns true if "ident" matches the instance's selector. */
+_Bool inst_ident_matches (graph_instance_t *inst, const graph_ident_t *ident);
+
+/* Returns true if the instance's selector matches the (more general)
+ * "selector" ident. */
+_Bool inst_matches_ident (graph_instance_t *inst,
+ const graph_ident_t *selector);
_Bool inst_matches_string (graph_config_t *cfg, graph_instance_t *inst,
const char *term);