From: Florian Forster Date: Fri, 2 Jul 2010 18:31:23 +0000 (+0200) Subject: src/graph.c: graph_add_def: Add graphs in reverse order. X-Git-Tag: v4.0.0~163 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cf3388109bd48029d5d0e9e78d4389bb682eb18d;p=collection4.git src/graph.c: graph_add_def: Add graphs in reverse order. --- 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) /* {{{ */