From 87431ad74f0642e067cd0bf6e9e80c50a749e6cd Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 4 May 2024 23:58:48 +0200 Subject: Don’t take a pointer argument in da_foreach MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/dynarr.h | 2 +- test/_brk-test.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/dynarr.h b/include/dynarr.h index 255ab94..dcc28a6 100644 --- a/include/dynarr.h +++ b/include/dynarr.h @@ -48,6 +48,6 @@ } while (false) #define da_foreach(da, p) \ - for (auto p = (da)->buf; (size_t)(p - (da)->buf) < (da)->len; p++) + for (auto p = (da).buf; (size_t)(p - (da).buf) < (da).len; p++) #endif /* !MLIB_DYNARR_H */ diff --git a/test/_brk-test.h b/test/_brk-test.h index 69e7e0a..e599578 100644 --- a/test/_brk-test.h +++ b/test/_brk-test.h @@ -76,7 +76,7 @@ test(struct u8view sv, int id) size_t off = 0; char8_t *p = bufalloc(nullptr, 1, total); - da_foreach (&items, g) { + da_foreach (items, g) { memcpy(p + off, g->buf, g->len); off += g->len; } @@ -102,7 +102,7 @@ test(struct u8view sv, int id) } } - da_foreach (&items, wd) + da_foreach (items, wd) free(wd->buf); free(items.buf); free(p); -- cgit v1.2.3