X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Farray%2Farray.h;h=c2efa3ce707d74678ca51e503e2e6b7644b62774;hb=e0e921b9feaa32212fe151970686daf120e81b21;hp=69b25ec6677ae18dcc87db7ac7949318e7f3ca58;hpb=c1daa044b22fce3ca80d3430e3e1ad9360f8a4f1;p=ccan diff --git a/ccan/array/array.h b/ccan/array/array.h index 69b25ec6..c2efa3ce 100644 --- a/ccan/array/array.h +++ b/ccan/array/array.h @@ -38,10 +38,8 @@ #include #endif -#define HAVE_ATTRIBUTE_MAY_ALIAS 1 - //Use the array_alias macro to indicate that a pointer has changed but strict aliasing rules are too stupid to know it -#if HAVE_ATTRIBUTE_MAY_ALIAS==1 +#if HAVE_ATTRIBUTE_MAY_ALIAS #define array_alias(ptr) /* nothing */ #define array(type) struct {type *item; size_t size; size_t alloc;} __attribute__((__may_alias__)) #else @@ -88,7 +86,7 @@ #define array_append_items(array, items, count) do {size_t __count = (count); array_resize(array, (array).size+__count); memcpy((array).item+(array).size-__count, items, __count*sizeof(*(array).item));} while(0) #define array_prepend(array, ...) do {array_resize(array, (array).size+1); memmove((array).item+1, (array).item, ((array).size-1)*sizeof(*(array).item)); *(array).item = (__VA_ARGS__);} while(0) #define array_push(array, ...) array_append(array, __VA_ARGS__) -#define array_pop(array) ((array).size ? array_pop_nocheck(array) : NULL) +#define array_pop_check(array) ((array).size ? array_pop(array) : NULL) #define array_growalloc(array, newAlloc) do {size_t __newAlloc=(newAlloc); if (__newAlloc > (array).alloc) array_realloc(array, (__newAlloc+63)&~63); } while(0) #if HAVE_STATEMENT_EXPR==1 @@ -97,7 +95,7 @@ //We do just fine by ourselves -#define array_pop_nocheck(array) ((array).item[--(array).size]) +#define array_pop(array) ((array).item[--(array).size]) #if HAVE_TYPEOF==1