diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-04 00:36:57 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-04 00:36:57 +0100 |
commit | 2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018 (patch) | |
tree | 7f640c7845bd26823b8d6108b4f554bf5b6c9d97 /linked_list.h | |
parent | Add linked list generic type. (diff) | |
download | calp-2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018.tar.gz calp-2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018.tar.xz |
Work on propper memmory management for linked lists.
Diffstat (limited to 'linked_list.h')
-rw-r--r-- | linked_list.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/linked_list.h b/linked_list.h index 666524be..a76c3443 100644 --- a/linked_list.h +++ b/linked_list.h @@ -6,8 +6,6 @@ #define LLIST(T) TP(llist__, T) #define LINK(T) TP(llist_link__, T) -#define LLIST_INIT(T) CONSTRUCTOR_GEN(llist, T, 0); -#define LLIST_FREE(T) TP(llist_free__, T) #define LLIST_CONS(T) TP(llist_cons__, T) #endif /* LINKED_LIST_H */ @@ -27,12 +25,15 @@ typedef struct { } LLIST(TYPE); int CONSTRUCTOR_DECL ( LLIST(TYPE) ); -int LLIST_FREE(TYPE) ( LLIST(TYPE)* ); +int FREE_DECL( LLIST(TYPE) ); int CONSTRUCTOR_DECL ( LINK(TYPE) ); +int CONSTRUCTOR_DECL ( LINK(TYPE), TYPE* val ); int LLIST_CONS(TYPE) ( LLIST(TYPE)* lst, TYPE* val); int DEEP_COPY(LLIST(TYPE)) ( LLIST(TYPE)* dest, LLIST(TYPE)* src ); +int APPEND(LLIST(TYPE)) ( LLIST(TYPE)* dest, LLIST(TYPE)* new ); + #endif /* TYPE */ |