projects
/
collection4.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
"graph_def_json" action: Make this work with ad-hoc DEFs, too.
[collection4.git]
/
src
/
graph.c
diff --git
a/src/graph.c
b/src/graph.c
index
deeb05a
..
713d45f
100644
(file)
--- 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 */
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) \
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"));
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);
yajl_gen_map_close (handler);