diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-11-09 14:34:40 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-11-09 15:22:26 -0500 |
commit | ffa465b759204272a5e94d851ce3696c827e9d96 (patch) | |
tree | dee7ff57530123d3cd2af0d01334449732c71966 /src/list.h | |
parent | 5fe11b94b38bfb4d43637e05ac24da0d7d72b9ea (diff) | |
download | bfs-ffa465b759204272a5e94d851ce3696c827e9d96.tar.xz |
list: Simplify slist_remove_impl()
We now assume that all-bits-zero is a null pointer, so memset is fine.
Diffstat (limited to 'src/list.h')
-rw-r--r-- | src/list.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -317,15 +317,15 @@ #define SLIST_REMOVE__(list, cursor, next) \ (list->tail = (*cursor)->next ? list->tail : cursor, \ - slist_remove_impl(*cursor, cursor, &(*cursor)->next, list->tail, sizeof(*cursor))) + slist_remove_impl(*cursor, cursor, &(*cursor)->next, sizeof(*cursor))) // Helper for SLIST_REMOVE() -static inline void *slist_remove_impl(void *ret, void *cursor, void *next, void *tail, size_t size) { +static inline void *slist_remove_impl(void *ret, void *cursor, void *next, size_t size) { // ret = *cursor; // *cursor = ret->next; memcpy(cursor, next, size); - // ret->next = *list->tail; (NULL) - memcpy(next, tail, size); + // ret->next = NULL; + memset(next, 0, size); return ret; } |