X-Git-Url: https://git.octo.it/?p=collection4.git;a=blobdiff_plain;f=src%2Faction_graph_def_json.c;h=2003d2f4c062c5d6b643baeeb9353d97770897a7;hp=684ad7a0db850ede798cd31069e5455ae912619f;hb=e3fb09073a64cc051c11c4a1bdcec493f937b764;hpb=a4a5b5e992da52779d9e1c8870f0c7df6b199d56 diff --git a/src/action_graph_def_json.c b/src/action_graph_def_json.c index 684ad7a..2003d2f 100644 --- a/src/action_graph_def_json.c +++ b/src/action_graph_def_json.c @@ -32,6 +32,7 @@ #include "action_graph_def_json.h" #include "common.h" #include "graph.h" +#include "graph_instance.h" #include "graph_list.h" #include "utils_cgi.h" @@ -50,6 +51,7 @@ static void write_callback (__attribute__((unused)) void *ctx, /* {{{ */ int action_graph_def_json (void) /* {{{ */ { graph_config_t *cfg; + graph_instance_t *inst; yajl_gen_config handler_config; yajl_gen handler; @@ -62,6 +64,10 @@ int action_graph_def_json (void) /* {{{ */ if (cfg == NULL) return (ENOMEM); + inst = inst_get_selected (cfg); + if (inst == NULL) + return (EINVAL); + memset (&handler_config, 0, sizeof (handler_config)); handler_config.beautify = 1; handler_config.indentString = " "; @@ -71,10 +77,7 @@ int action_graph_def_json (void) /* {{{ */ /* alloc functions = */ NULL, /* context = */ NULL); if (handler == NULL) - { - graph_destroy (cfg); return (-1); - } printf ("Content-Type: application/json\n"); @@ -86,9 +89,8 @@ int action_graph_def_json (void) /* {{{ */ time_buffer); printf ("\n"); - status = graph_def_to_json (cfg, handler); + status = graph_def_to_json (cfg, inst, handler); - graph_destroy (cfg); yajl_gen_free (handler); return (status);