From 173a3843530edd1049a7b4071883574e363c2bec Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 14 Jun 2010 17:18:09 +0200 Subject: [PATCH] graph_def.[ch]: Implement "def_append". --- graph_def.c | 16 ++++++++++++++++ graph_def.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/graph_def.c b/graph_def.c index 80f6a0c..853508e 100644 --- a/graph_def.c +++ b/graph_def.c @@ -69,6 +69,22 @@ void def_destroy (graph_def_t *def) /* {{{ */ def_destroy (next); } /* }}} void def_destroy */ +int def_append (graph_def_t *head, graph_def_t *def) /* {{{ */ +{ + graph_def_t *ptr; + + if ((head == NULL) || (def == NULL)) + return (EINVAL); + + ptr = head; + while (ptr->next != NULL) + ptr = ptr->next; + + ptr->next = def; + + return (0); +} /* }}} int def_append */ + graph_def_t *def_search (graph_def_t *head, graph_ident_t *ident) /* {{{ */ { graph_def_t *ptr; diff --git a/graph_def.h b/graph_def.h index 780ed37..f9c4f5a 100644 --- a/graph_def.h +++ b/graph_def.h @@ -12,6 +12,8 @@ graph_def_t *def_create (graph_config_t *cfg, graph_ident_t *ident); void def_destroy (graph_def_t *def); +int def_append (graph_def_t *head, graph_def_t *def); + graph_def_t *def_search (graph_def_t *head, graph_ident_t *ident); int def_get_rrdargs (graph_def_t *def, graph_ident_t *ident, -- 2.30.2