X-Git-Url: http://git.madism.org/?p=apps%2Fpfixtools.git;a=blobdiff_plain;f=common%2Farray.h;h=6cb7619f95aab8d5374d3db6a14a629dd23ac11f;hp=ed12b5b384566796ae90158236085abc9a9f7c2d;hb=0df827a28124af3bb45cea7a3b80e5d1800bb1e2;hpb=70ec82c2314c3271f080ea6fccc6e8e4964c39d3 diff --git a/common/array.h b/common/array.h index ed12b5b..6cb7619 100644 --- a/common/array.h +++ b/common/array.h @@ -48,6 +48,7 @@ } #define ARRAY(Type) \ typedef PRIV_ARRAY(Type) Type ## _array_t; \ + typedef PRIV_ARRAY(Type*) Type ## _ptr_array_t; \ \ static inline Type ## _array_t *Type ## _array_new(void) \ { \ @@ -55,6 +56,19 @@ } \ \ static inline void Type ## _array_delete(Type ## _array_t **array) \ + { \ + if (*array) { \ + array_wipe(**array); \ + p_delete(array); \ + } \ + } \ + \ + static inline Type ## _ptr_array_t *Type ## _ptr_array_new(void) \ + { \ + return p_new(Type ## _ptr_array_t, 1); \ + } \ + \ + static inline void Type ## _ptr_array_delete(Type ## _ptr_array_t **array) \ { \ if (*array) { \ array_wipe(**array); \ @@ -62,6 +76,7 @@ } \ } #define A(Type) Type ## _array_t +#define PA(Type) Type ## _ptr_array_t #define ARRAY_INIT { NULL, 0, 0 }