summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 50e4d66)
raw | patch | inline | side by side (parent: 50e4d66)
author | Florian Forster <ff@octo.it> | |
Mon, 12 Jul 2010 09:44:47 +0000 (11:44 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 12 Jul 2010 09:44:47 +0000 (11:44 +0200) |
src/graph_list.c | patch | blob | history | |
src/graph_list.h | patch | blob | history |
diff --git a/src/graph_list.c b/src/graph_list.c
index cf0ca4af8694e4766a627e1318536bb8ed00ff82..a33697f4c084b6b49ef5ef19b034fe871a8c5b95 100644 (file)
--- a/src/graph_list.c
+++ b/src/graph_list.c
#include "graph_def.h"
#include "graph_ident.h"
#include "utils_cgi.h"
+#include "utils_search.h"
#include <fcgiapp.h>
#include <fcgi_stdio.h>
} /* }}} int gl_instance_get_all */
/* }}} gl_instance_get_all, gl_graph_instance_get_all */
+int gl_search (search_info_t *si, /* {{{ */
+ graph_inst_callback_t callback, void *user_data)
+{
+ size_t i;
+ graph_ident_t *ident;
+
+ if ((si == NULL) || (callback == NULL))
+ return (EINVAL);
+
+ ident = search_to_ident (si);
+ if (ident == NULL)
+ {
+ fprintf (stderr, "gl_search: search_to_ident failed\n");
+ return (-1);
+ }
+
+ for (i = 0; i < gl_active_num; i++)
+ {
+ int status;
+
+ if (!graph_matches_ident (gl_active[i], ident))
+ continue;
+
+ status = graph_search_inst (gl_active[i], si,
+ /* callback = */ callback,
+ /* user data = */ user_data);
+ if (status != 0)
+ return (status);
+ }
+
+ for (i = 0; i < gl_dynamic_num; i++)
+ {
+ int status;
+
+ if (!graph_matches_ident (gl_dynamic[i], ident))
+ continue;
+
+ status = graph_search_inst (gl_dynamic[i], si,
+ /* callback = */ callback,
+ /* user data = */ user_data);
+ if (status != 0)
+ return (status);
+ }
+
+ return (0);
+} /* }}} int gl_search */
+
int gl_search_string (const char *term, graph_inst_callback_t callback, /* {{{ */
void *user_data)
{
diff --git a/src/graph_list.h b/src/graph_list.h
index b238a9ea01b264e99c759b058265d6a1235e4006..b25fb2156a8f4affc7cd812df63bfdca45a2911b 100644 (file)
--- a/src/graph_list.h
+++ b/src/graph_list.h
#include "graph_types.h"
#include "graph_ident.h"
+#include "utils_search.h"
/*
* Functions
int gl_instance_get_all (graph_inst_callback_t callback, void *user_data);
+int gl_search (search_info_t *si, graph_inst_callback_t callback,
+ void *user_data);
+
int gl_search_string (const char *search, graph_inst_callback_t callback,
void *user_data);