From cf3388109bd48029d5d0e9e78d4389bb682eb18d Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 2 Jul 2010 20:31:23 +0200 Subject: [PATCH] src/graph.c: graph_add_def: Add graphs in reverse order. --- src/graph.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/graph.c b/src/graph.c index 8d12a25..d4b1a32 100644 --- a/src/graph.c +++ b/src/graph.c @@ -256,6 +256,8 @@ graph_def_t *graph_get_defs (graph_config_t *cfg) /* {{{ */ int graph_add_def (graph_config_t *cfg, graph_def_t *def) /* {{{ */ { + graph_def_t *tmp; + if ((cfg == NULL) || (def == NULL)) return (EINVAL); @@ -265,7 +267,11 @@ int graph_add_def (graph_config_t *cfg, graph_def_t *def) /* {{{ */ return (0); } - return (def_append (cfg->defs, def)); + /* Insert in reverse order. This makes the order in the config file and the + * order of the DEFs in the graph more natural. Really. */ + tmp = cfg->defs; + cfg->defs = def; + return (def_append (cfg->defs, tmp)); } /* }}} int graph_add_def */ _Bool graph_matches_ident (graph_config_t *cfg, const graph_ident_t *ident) /* {{{ */ -- 2.11.0