diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-04 11:25:37 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-05 18:06:13 +0100 |
commit | dc8474d9034d9281463bb69f7f7a922e3ea713ee (patch) | |
tree | c3b870ada88f7aaa48918c4eb8b5d865f2f82019 /linked_list.inc.h | |
parent | Work on propper memmory management for linked lists. (diff) | |
download | calp-dc8474d9034d9281463bb69f7f7a922e3ea713ee.tar.gz calp-dc8474d9034d9281463bb69f7f7a922e3ea713ee.tar.xz |
Normalize and improve INIT & FREE macros.
Diffstat (limited to 'linked_list.inc.h')
-rw-r--r-- | linked_list.inc.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/linked_list.inc.h b/linked_list.inc.h index a878d075..b6942a94 100644 --- a/linked_list.inc.h +++ b/linked_list.inc.h @@ -2,7 +2,7 @@ #error "Set TYPE before including this file" #else -int CONSTRUCTOR_DECL ( LLIST(TYPE) ) { +INIT_F ( LLIST(TYPE) ) { this->length = 0; NEW(LINK(TYPE), head); NEW(LINK(TYPE), tail); @@ -14,7 +14,7 @@ int CONSTRUCTOR_DECL ( LLIST(TYPE) ) { return 0; } -int FREE_DECL( LLIST(TYPE) ) { +FREE_F( LLIST(TYPE) ) { LINK(TYPE) *node, *next; node = this->head->after; while (node->after != NULL) { @@ -31,14 +31,14 @@ int FREE_DECL( LLIST(TYPE) ) { return 0; } -int CONSTRUCTOR_DECL ( LINK(TYPE) ) { +INIT_F ( LINK(TYPE) ) { this->before = NULL; this->after = NULL; this->value = NULL; return 0; } -int CONSTRUCTOR_DECL ( LINK(TYPE), TYPE* val ) { +INIT_F ( LINK(TYPE), TYPE* val ) { this->before = NULL; this->after = NULL; this->value = val; |