diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-10-03 20:27:51 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-10-03 20:27:51 +0200 |
commit | 2fdc8dba3690419f2b0dd12b3d6d1c391cc54ba2 (patch) | |
tree | 4d9dbbc4a3b202c5edbf218293042e87cca186fd /include | |
parent | 4b3fcb1b0187b55ddaedfc87a39c518fb9cac365 (diff) |
Don’t require arg to be passed by reference
Diffstat (limited to 'include')
-rw-r--r-- | include/array.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/array.h b/include/array.h index 11d8180..f8090cf 100644 --- a/include/array.h +++ b/include/array.h @@ -34,12 +34,12 @@ _mlib_array_hdr(void *p, ptrdiff_t align) #define array_push(p, x) \ do { \ - _mlib_arr_hdr_t *hdr = _mlib_array_hdr(*(p), alignof(typeof(**(p)))); \ + _mlib_arr_hdr_t *hdr = _mlib_array_hdr((p), alignof(typeof(*(p)))); \ if (hdr->len == hdr->cap) { \ - *(p) = array_resz(*(p), hdr->len * 2); \ - hdr = _mlib_array_hdr(*(p), alignof(typeof(**(p)))); \ + (p) = array_resz((p), hdr->len * 2); \ + hdr = _mlib_array_hdr((p), alignof(typeof(*(p)))); \ } \ - (*(p))[hdr->len++] = (x); \ + (p)[hdr->len++] = (x); \ } while (false) #define array_extend(p, xs, n) \ |