X-Git-Url: http://git.madism.org/?p=apps%2Fpfixtools.git;a=blobdiff_plain;f=common%2Farray.h;h=f1c6925285c329434ae23345bca1d81516f7e2de;hp=6cb7619f95aab8d5374d3db6a14a629dd23ac11f;hb=5c75febadf099c0a656b3b8072b14ec14b38c2f6;hpb=52179a67b5e09f3f767789abd7857ae17d5f15c2 diff --git a/common/array.h b/common/array.h index 6cb7619..f1c6925 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,7 @@ ARRAY(char) ARRAY(int) +ARRAY(bool) ARRAY(uint32_t) #endif