From 4e739f6b368acec0aa3b3a168666c914a8e388b5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 20 Mar 2020 16:51:12 +0900 Subject: [PATCH] Use dynamic array element type instead of __auto_type This allows using 0 for pointer arrays. --- include/QF/darray.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/QF/darray.h b/include/QF/darray.h index 05387b2fe..2b8689726 100644 --- a/include/QF/darray.h +++ b/include/QF/darray.h @@ -186,10 +186,10 @@ #define DARRAY_APPEND(array, value) \ ({ \ __auto_type ar = (array); \ - __auto_type ob = (value); \ + typeof(ar->a[0]) ob = (value); \ size_t sz = ar->size; \ DARRAY_RESIZE (ar, ar->size + 1); \ - ar->a[sz] = ob; \ + ar->a[sz] = ob; \ }) /** Open a hole in the array for bulk copying of data. @@ -259,7 +259,7 @@ #define DARRAY_INSERT_AT(array, value, index) \ ({ \ __auto_type ar = (array); \ - __auto_type ob = (value); \ + typeof(ar->a[0]) ob = (value); \ *DARRAY_OPEN_AT (ar, index, 1) = ob; \ })