From: Florian Forster Date: Mon, 12 Jul 2010 09:28:04 +0000 (+0200) Subject: src/graph.[ch]: Implement "graph_matches_ident". X-Git-Tag: v4.0.0~105 X-Git-Url: https://git.octo.it/?p=collection4.git;a=commitdiff_plain;h=559db522731e674dbdad045d0e65b9376e2f91f4 src/graph.[ch]: Implement "graph_matches_ident". --- diff --git a/src/graph.c b/src/graph.c index 845bbb7..75c83b1 100644 --- a/src/graph.c +++ b/src/graph.c @@ -307,6 +307,17 @@ _Bool graph_ident_matches (graph_config_t *cfg, const graph_ident_t *ident) /* { return (ident_matches (cfg->select, ident)); } /* }}} _Bool graph_ident_matches */ +_Bool graph_matches_ident (graph_config_t *cfg, /* {{{ */ + const graph_ident_t *selector) +{ +#if C4_DEBUG + if ((cfg == NULL) || (selector == NULL)) + return (0); +#endif + + return (ident_matches (selector, cfg->select)); +} /* }}} _Bool graph_matches_ident */ + _Bool graph_matches_field (graph_config_t *cfg, /* {{{ */ graph_ident_field_t field, const char *field_value) { diff --git a/src/graph.h b/src/graph.h index 7a433f1..69a3fbe 100644 --- a/src/graph.h +++ b/src/graph.h @@ -52,8 +52,15 @@ graph_def_t *graph_get_defs (graph_config_t *cfg); int graph_add_def (graph_config_t *cfg, graph_def_t *def); +/* Returns true if the given "ident" matches the (more general) selector of + * the graph "cfg". */ _Bool graph_ident_matches (graph_config_t *cfg, const graph_ident_t *ident); +/* Returns true if the selector of the graph "cfg" matches the more general + * ident "selector". */ +_Bool graph_matches_ident (graph_config_t *cfg, + const graph_ident_t *selector); + /* Compares the given string with the appropriate field of the selector. If the * selector field is "/all/" or "/any/", returns true without checking the * instances. See "graph_inst_search_field" for finding all matching instances.