X-Git-Url: https://git.octo.it/?p=collection4.git;a=blobdiff_plain;f=src%2Fgraph.c;h=713d45f92c2b8c984da9ec309bbdd832e0904697;hp=deeb05a649aa50a11bec580acde42b63c11e8e1e;hb=13fbd841132a9bb8ddf83f614662113b3b36653c;hpb=d14486b469ab7e564d883a4196bf4bd26b197ed8 diff --git a/src/graph.c b/src/graph.c index deeb05a..713d45f 100644 --- a/src/graph.c +++ b/src/graph.c @@ -649,7 +649,8 @@ int graph_to_json (const graph_config_t *cfg, /* {{{ */ return (0); } /* }}} int graph_to_json */ -int graph_def_to_json (const graph_config_t *cfg, /* {{{ */ +int graph_def_to_json (graph_config_t *cfg, /* {{{ */ + graph_instance_t *inst, yajl_gen handler) { #define yajl_gen_string_cast(h,p,l) \ @@ -676,7 +677,18 @@ int graph_def_to_json (const graph_config_t *cfg, /* {{{ */ yajl_gen_bool (handler, cfg->show_zero); yajl_gen_string_cast (handler, "defs", strlen ("defs")); - def_to_json (cfg->defs, handler); + if (cfg->defs == NULL) + { + graph_def_t *defs; + + defs = inst_get_default_defs (cfg, inst); + def_to_json (defs, handler); + def_destroy (defs); + } + else + { + def_to_json (cfg->defs, handler); + } yajl_gen_map_close (handler);