summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c08cfbb)
raw | patch | inline | side by side (parent: c08cfbb)
author | Florian Forster <octo@verplant.org> | |
Thu, 22 Dec 2011 08:07:04 +0000 (09:07 +0100) | ||
committer | Florian Forster <octo@verplant.org> | |
Thu, 22 Dec 2011 08:07:21 +0000 (09:07 +0100) |
src/action_list_graphs_json.c | patch | blob | history |
index 120e419b6a78af0cd8fe91593181b6bbbe3fd6c9..f8485cece2b60c9162fbe287dd47b2d1d78416f4 100644 (file)
static int print_one_graph (graph_config_t *cfg, /* {{{ */
void *user_data)
{
- char params[1024];
char title[1024];
size_t num_instances;
+ graph_ident_t *selector;
yajl_gen handler = user_data;
if (num_instances < 1)
return (0);
+ selector = graph_get_selector (cfg);
+ if (selector == NULL)
+ {
+ /* TODO: Print error. */
+ return (0);
+ }
+
yajl_gen_map_open (handler);
memset (title, 0, sizeof (title));
graph_get_title (cfg, title, sizeof (title));
- memset (params, 0, sizeof (params));
- graph_get_params (cfg, params, sizeof (params));
-
yajl_gen_string (handler,
(unsigned char *) "title",
(unsigned int) strlen ("title"));
(unsigned int) strlen (title));
yajl_gen_string (handler,
- (unsigned char *) "params",
- (unsigned int) strlen ("params"));
- yajl_gen_string (handler,
- (unsigned char *) params,
- (unsigned int) strlen (params));
+ (unsigned char *) "selector",
+ (unsigned int) strlen ("selector"));
+ ident_to_json (selector, handler);
yajl_gen_string (handler,
(unsigned char *) "num_instances",
yajl_gen_map_close (handler);
+ ident_destroy (selector);
+
return (0);
} /* }}} int print_one_graph */