diff options
| author | @syxhe <https://t.me/syxhe> | 2025-03-24 17:59:33 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2025-03-24 17:59:33 -0500 |
| commit | 3b5bf3b6ab23c6a5157919490cc07787614f95b8 (patch) | |
| tree | df5461c0c0673f5cf8ae9a71583b49fb3ddccfd3 /src/ll.c | |
| parent | 4d02dcea167d7f45118510ff87217d590456c720 (diff) | |
Add a warning to ll.h about how dlinkedlist functions are X_ALLOC functions
Diffstat (limited to 'src/ll.c')
| -rw-r--r-- | src/ll.c | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <stddef.h> | 4 | #include <stddef.h> |
| 5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
| 6 | #include <errno.h> | 6 | #include <errno.h> |
| 7 | #include <error.h> | ||
| 7 | 8 | ||
| 8 | typedef struct dll { | 9 | typedef struct dll { |
| 9 | void *data; | 10 | void *data; |
| @@ -118,7 +119,8 @@ int dlinkedlist_xxxend(dlinkedlist * const ll, void *data, dll_freecb fcb, char | |||
| 118 | break; | 119 | break; |
| 119 | 120 | ||
| 120 | default: | 121 | default: |
| 121 | abort(); | 122 | XALLOC_EXIT("<dlinkedlist_xxxend> got an invalid op token when it shouldn't be possible to recieve one"); |
| 123 | // Technically not an alloc, but also there's no reason I can't reuse a perfectly good macro | ||
| 122 | } | 124 | } |
| 123 | 125 | ||
| 124 | ll->size++; | 126 | ll->size++; |
| @@ -172,7 +174,7 @@ int dlinkedlist_insert(dlinkedlist * const ll, void *data, dll_freecb fcb, int i | |||
| 172 | dllnode *new = dllnode_init(data, fcb); | 174 | dllnode *new = dllnode_init(data, fcb); |
| 173 | dllnode *current = dlinkedlist_getnode(ll, index); | 175 | dllnode *current = dlinkedlist_getnode(ll, index); |
| 174 | if(!current) | 176 | if(!current) |
| 175 | abort(); | 177 | XALLOC_EXIT("<dlinkedlist_insert> somehow managed to pull a null node from dlinkedlist_getnode(... , ... , ... , %d)", , (index)); |
| 176 | 178 | ||
| 177 | current->prev->next = new; | 179 | current->prev->next = new; |
| 178 | new->prev = current->prev; | 180 | new->prev = current->prev; |
