squareball  0.2.0.43-8b14
A general-purpose library for C99
sb-slist.h
Go to the documentation of this file.
1 /*
2  * squareball: A general-purpose library for C99.
3  * Copyright (C) 2014-2018 Rafael G. Martins <rafael@rafaelmartins.eng.br>
4  *
5  * This program can be distributed under the terms of the BSD License.
6  * See the file LICENSE.
7  */
8 
9 #ifndef _SQUAREBALL_SLIST_H
10 #define _SQUAREBALL_SLIST_H
11 
12 #include "sb-mem.h"
13 
22 typedef struct _sb_slist_t {
23 
25  struct _sb_slist_t *next;
26 
28  void *data;
29 
30 } sb_slist_t;
31 
40 sb_slist_t* sb_slist_append(sb_slist_t *l, void *data);
41 
50 sb_slist_t* sb_slist_prepend(sb_slist_t *l, void *data);
51 
57 void sb_slist_free(sb_slist_t *l);
58 
66 void sb_slist_free_full(sb_slist_t *l, sb_free_func_t free_func);
67 
74 size_t sb_slist_length(sb_slist_t *l);
75 
78 #endif /* _SQUAREBALL_SLIST_H */
void sb_slist_free(sb_slist_t *l)
void sb_slist_free_full(sb_slist_t *l, sb_free_func_t free_func)
sb_slist_t * sb_slist_prepend(sb_slist_t *l, void *data)
size_t sb_slist_length(sb_slist_t *l)
struct _sb_slist_t * next
Definition: sb-slist.h:25
void(* sb_free_func_t)(void *ptr)
Definition: sb-mem.h:29
Definition: sb-slist.h:22
void * data
Definition: sb-slist.h:28
Memory allocation related helpers.
sb_slist_t * sb_slist_append(sb_slist_t *l, void *data)