X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgraph_list.c;h=4e43a6758334464042bd44f46dd840eab28d0d37;hb=bd4c412a357988288796a473ad0ea7adb6745db0;hp=f3e97385a4464850c2e2891f38084698a4c3900f;hpb=e9d94ae68f4081b25c4d278cea49b51354062e7d;p=collection4.git diff --git a/src/graph_list.c b/src/graph_list.c index f3e9738..4e43a67 100644 --- a/src/graph_list.c +++ b/src/graph_list.c @@ -7,6 +7,7 @@ #include #include "graph_list.h" +#include "graph.h" #include "graph_ident.h" #include "graph_def.h" #include "graph_config.h" @@ -73,7 +74,7 @@ static int gl_register_file (const graph_ident_t *file, /* {{{ */ graph_config_t *cfg = gl_active[i]; int status; - if (!graph_matches (cfg, file)) + if (!graph_matches_ident (cfg, file)) continue; status = graph_add_file (cfg, file); @@ -236,8 +237,7 @@ int gl_graph_instance_get_all (graph_config_t *cfg, /* {{{ */ if ((cfg == NULL) || (callback == NULL)) return (EINVAL); - return (inst_foreach (graph_get_instances (cfg), - gl_inst_callback_handler, &data)); + return (graph_inst_foreach (cfg, gl_inst_callback_handler, &data)); } /* }}} int gl_graph_instance_get_all */ int gl_instance_get_all (graph_inst_callback_t callback, /* {{{ */ @@ -269,7 +269,7 @@ int gl_search (const char *term, graph_inst_callback_t callback, /* {{{ */ { int status; - status = graph_search (gl_active[i], term, + status = graph_inst_search (gl_active[i], term, /* callback = */ callback, /* user data = */ user_data); if (status != 0) @@ -279,6 +279,30 @@ int gl_search (const char *term, graph_inst_callback_t callback, /* {{{ */ return (0); } /* }}} int gl_search */ +int gl_search_field (graph_ident_field_t field, /* {{{ */ + const char *field_value, + graph_inst_callback_t callback, void *user_data) +{ + size_t i; + + if ((field_value == NULL) || (callback == NULL)) + return (EINVAL); + + for (i = 0; i < gl_active_num; i++) + { + int status; + + status = graph_inst_search_field (gl_active[i], + field, field_value, + /* callback = */ callback, + /* user data = */ user_data); + if (status != 0) + return (status); + } + + return (0); +} /* }}} int gl_search_field */ + int gl_update (void) /* {{{ */ { time_t now;