diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-02-26 01:04:32 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-02-26 01:04:32 +0100 |
commit | 3b0f9293a3432023cdca91df01418347d9781ffa (patch) | |
tree | e872df7080979732ddf3efbdaabc8a4bdafd0653 /src/utils/slist.c | |
parent | bdff66b0013165c3ef7eff644fb276235f3dd082 (diff) | |
download | blogc-3b0f9293a3432023cdca91df01418347d9781ffa.tar.gz blogc-3b0f9293a3432023cdca91df01418347d9781ffa.tar.bz2 blogc-3b0f9293a3432023cdca91df01418347d9781ffa.zip |
build: replace src/utils with squareball
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; -} |