From: Florian Forster Date: Mon, 14 Jun 2010 15:18:09 +0000 (+0200) Subject: graph_def.[ch]: Implement "def_append". X-Git-Tag: v4.0.0~279 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=173a3843530edd1049a7b4071883574e363c2bec;p=collection4.git graph_def.[ch]: Implement "def_append". --- 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,