X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=common%2Farray.h;h=b4dea94af489083e4e9f24e7e77159113fbe9e65;hb=d229b104fb45ef8a5b968da80383f571625fa976;hp=6cb7619f95aab8d5374d3db6a14a629dd23ac11f;hpb=0df827a28124af3bb45cea7a3b80e5d1800bb1e2;p=apps%2Fpfixtools.git diff --git a/common/array.h b/common/array.h index 6cb7619..b4dea94 100644 --- a/common/array.h +++ b/common/array.h @@ -46,35 +46,40 @@ ssize_t len; \ ssize_t size; \ } -#define ARRAY(Type) \ - typedef PRIV_ARRAY(Type) Type ## _array_t; \ + +#define PARRAY(Type) \ typedef PRIV_ARRAY(Type*) Type ## _ptr_array_t; \ - \ - static inline Type ## _array_t *Type ## _array_new(void) \ + static inline Type ## _ptr_array_t *Type ## _ptr_array_new(void) \ { \ - return p_new(Type ## _array_t, 1); \ + return p_new(Type ## _ptr_array_t, 1); \ } \ \ - static inline void Type ## _array_delete(Type ## _array_t **array) \ + static inline void Type ## _ptr_array_delete(Type ## _ptr_array_t **array) \ { \ if (*array) { \ array_wipe(**array); \ p_delete(array); \ } \ - } \ + } + +#define ARRAY(Type) \ + typedef PRIV_ARRAY(Type) Type ## _array_t; \ \ - static inline Type ## _ptr_array_t *Type ## _ptr_array_new(void) \ + static inline Type ## _array_t *Type ## _array_new(void) \ { \ - return p_new(Type ## _ptr_array_t, 1); \ + return p_new(Type ## _array_t, 1); \ } \ \ - static inline void Type ## _ptr_array_delete(Type ## _ptr_array_t **array) \ + static inline void Type ## _array_delete(Type ## _array_t **array) \ { \ if (*array) { \ array_wipe(**array); \ p_delete(array); \ } \ - } + } \ + \ + PARRAY(Type) + #define A(Type) Type ## _array_t #define PA(Type) Type ## _ptr_array_t @@ -145,6 +150,9 @@ ARRAY(char) ARRAY(int) +ARRAY(bool) ARRAY(uint32_t) +PARRAY(void) + #endif