diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-05-07 04:43:30 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-05-07 04:43:30 +0200 |
commit | 68e4c6ce2cbcc16f5613a7731d4cfac13e4d3354 (patch) | |
tree | b07274c5478a9058be5eb67e3ba7be293a7c8df5 /src/utils/slist.c | |
parent | 4b676a3e0a21d494a1d47efcaf995537b29ff2b9 (diff) | |
parent | 4230e93c64c78ca4276a164704c8dc8a67e466e1 (diff) | |
download | blogc-68e4c6ce2cbcc16f5613a7731d4cfac13e4d3354.tar.gz blogc-68e4c6ce2cbcc16f5613a7731d4cfac13e4d3354.tar.bz2 blogc-68e4c6ce2cbcc16f5613a7731d4cfac13e4d3354.zip |
Merge branch 'master' into feature/directives
Diffstat (limited to 'src/utils/slist.c')
-rw-r--r-- | src/utils/slist.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/utils/slist.c b/src/utils/slist.c deleted file mode 100644 index 9753aa7..0000000 --- a/src/utils/slist.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * blogc: A blog compiler. - * Copyright (C) 2014-2016 Rafael G. Martins <rafael@rafaelmartins.eng.br> - * - * This program can be distributed under the terms of the BSD License. - * See the file LICENSE. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif /* HAVE_CONFIG_H */ - -#include <stdlib.h> -#include "utils.h" - - -b_slist_t* -b_slist_append(b_slist_t *l, void *data) -{ - b_slist_t *node = malloc(sizeof(b_slist_t)); - if (node == NULL) { - l = NULL; - return l; - } - node->data = data; - node->next = NULL; - if (l == NULL) - l = node; - else { - b_slist_t *tmp; - for (tmp = l; tmp->next != NULL; tmp = tmp->next); - tmp->next = node; - } - return l; -} - - -void -b_slist_free_full(b_slist_t *l, b_free_func_t free_func) -{ - while (l != NULL) { - b_slist_t *tmp = l->next; - free_func(l->data); - free(l); - l = tmp; - } -} - - -void -b_slist_free(b_slist_t *l) -{ - while (l != NULL) { - b_slist_t *tmp = l->next; - free(l); - l = tmp; - } -} - - -unsigned int -b_slist_length(b_slist_t *l) -{ - unsigned int i; - b_slist_t *tmp; - for (tmp = l, i = 0; tmp != NULL; tmp = tmp->next, i++); - return i; -} |