summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 33e56e5)
raw | patch | inline | side by side (parent: 33e56e5)
author | Florian Forster <octo@verplant.org> | |
Wed, 5 Dec 2012 09:54:46 +0000 (10:54 +0100) | ||
committer | Florian Forster <octo@verplant.org> | |
Wed, 5 Dec 2012 09:54:46 +0000 (10:54 +0100) |
src/action_show_graph_json.c | patch | blob | history | |
src/graph_list.h | patch | blob | history |
index 0820fb025614997ae39aca7737ded1406c82a75f..6d6e156ebee938f4f9695bb85cc62022b36bab7f 100644 (file)
int action_show_graph_json (void) /* {{{ */
{
- graph_config_t *cfg;
+ graph_config_t const *cfg;
yajl_gen_config handler_config;
yajl_gen handler;
/* alloc functions = */ NULL,
/* context = */ NULL);
if (handler == NULL)
- {
- graph_destroy (cfg);
return (-1);
- }
printf ("Content-Type: application/json\n");
status = graph_to_json (cfg, handler);
- graph_destroy (cfg);
yajl_gen_free (handler);
return (status);
diff --git a/src/graph_list.h b/src/graph_list.h
index ff35f18e06d545fbb38fca7d7c2364c2017def00..a2a61e62ec0fc0b4ca936d8ab7a5365e1543de79 100644 (file)
--- a/src/graph_list.h
+++ b/src/graph_list.h
int gl_register_data_provider (const char *name, data_provider_t *p);
+/*
+ * Returns the currently "selected" graph config.
+ *
+ * This function evaluates the HTTP query parameters and searches for a
+ * matching graph config structure. If a matching graph config is found, it
+ * will return a pointer to the graph config. Do *not* free or call
+ * graph_destroy() on this pointer. If no graph is found or parameters are
+ * incomplete, NULL is returned.
+ */
graph_config_t *gl_graph_get_selected (void);
int gl_graph_get_all (_Bool include_dynamic,