darray: handle case where we don't have typeof.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 22 Mar 2011 04:19:40 +0000 (14:49 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 22 Mar 2011 04:19:40 +0000 (14:49 +1030)
Tests don't compile otherwise, so fix that up (ccanlint now tests with
reduced features, so this became clear).

ccan/darray/test/run.c

index 7212c573d6575203662018ca4a4679f98358d4f1..3d96fa564614cd0b4b987943c48dffb5a9c55f02 100644 (file)
@@ -238,11 +238,20 @@ int main(void) {
        {
                darray(const char*) arr = darray_new();
                const char *n[9] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight"};
        {
                darray(const char*) arr = darray_new();
                const char *n[9] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight"};
-               
+
+#if HAVE_TYPEOF                
                darray_appends(arr, n[5], n[6], n[7], n[8]);
                darray_appends(arr, n[5], n[6], n[7], n[8]);
+#else
+               darray_appends_t(arr, const char *, n[5], n[6], n[7], n[8]);
+#endif
                ok1(darray_size(arr)==4 && darray_alloc(arr)>=4);
                ok1(darray_size(arr)==4 && darray_alloc(arr)>=4);
-               
+
+#if HAVE_TYPEOF                
                darray_prepends(arr, n[0], n[1], n[2], n[3], n[4]);
                darray_prepends(arr, n[0], n[1], n[2], n[3], n[4]);
+#else
+               darray_prepends_t(arr, const char *, n[0], n[1], n[2], n[3], n[4]);
+#endif
+
                ok1(darray_size(arr)==9 && darray_alloc(arr)>=9);
                
                ok1(arr.item[0]==n[0] &&
                ok1(darray_size(arr)==9 && darray_alloc(arr)>=9);
                
                ok1(arr.item[0]==n[0] &&