diff options
author | Michael Veksler <Mihails.Vekslers@zabbix.com> | 2018-07-12 16:21:24 +0300 |
---|---|---|
committer | Michael Veksler <Mihails.Vekslers@zabbix.com> | 2018-07-12 16:21:24 +0300 |
commit | 4174d4437652d6eeee3b54a2887220975ce43b2f (patch) | |
tree | 5818fd6d3ddf6ab5d5a5bdf39f77ac6508f0dec5 /include/zbxalgo.h | |
parent | b55fc2949177ff20572648ed7be3cb30cae18247 (diff) |
...G...PS. [DEV-699] implementation of zbx_vector_XXX_clear_ext() as typed function
Diffstat (limited to 'include/zbxalgo.h')
-rw-r--r-- | include/zbxalgo.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/include/zbxalgo.h b/include/zbxalgo.h index a69286af140..90414b60899 100644 --- a/include/zbxalgo.h +++ b/include/zbxalgo.h @@ -272,7 +272,7 @@ void zbx_binary_heap_clear(zbx_binary_heap_t *heap); #define ZBX_VECTOR_DECL(__id, __type) \ \ -typedef void (*zbx_clean_ ## __id ## _func_t)(__type *data); \ +typedef void (*zbx_clean_type_ ## __id ## _func_t)(__type *data); \ \ typedef struct \ { \ @@ -315,13 +315,19 @@ void zbx_vector_ ## __id ## _setdiff(zbx_vector_ ## __id ## _t *left, const zbx_ \ void zbx_vector_ ## __id ## _reserve(zbx_vector_ ## __id ## _t *vector, size_t size); \ void zbx_vector_ ## __id ## _clear(zbx_vector_ ## __id ## _t *vector); \ -void zbx_vector_ ## __id ## _clear_type(zbx_vector_ ## __id ## _t *vector, zbx_clean_ ## __id ## _func_t clean_func); +void zbx_vector_ ## __id ## _clear_type(zbx_vector_ ## __id ## _t *vector, zbx_clean_type_ ## __id ## _func_t clean_func); #define ZBX_PTR_VECTOR_DECL(__id, __type) \ \ ZBX_VECTOR_DECL(__id, __type); \ \ -void zbx_vector_ ## __id ## _clear_ext(zbx_vector_ ## __id ## _t *vector, zbx_clean_func_t clean_func); +typedef void (*zbx_clean_ ## __id ## _func_t)(__type data); \ + \ +void zbx_vector_ ## __id ## _clear_ext(zbx_vector_ ## __id ## _t *vector, zbx_clean_ ## __id ## _func_t clean_func);\ +/* this function is only for use with zbx_vector_XXX_clear_ext() */ \ +/* and only if the vector does not contain nested allocations */ \ +void zbx_ ## __id ## _free(__type data); + ZBX_VECTOR_DECL(uint64, zbx_uint64_t); ZBX_PTR_VECTOR_DECL(str, char *); @@ -329,10 +335,6 @@ ZBX_PTR_VECTOR_DECL(ptr, void *); ZBX_VECTOR_DECL(ptr_pair, zbx_ptr_pair_t); ZBX_VECTOR_DECL(uint64_pair, zbx_uint64_pair_t); -/* this function is only for use with zbx_vector_XXX_clear_ext() */ -/* and only if the vector does not contain nested allocations */ -void zbx_ptr_free(void *data); - /* 128 bit unsigned integer handling */ #define uset128(base, hi64, lo64) (base)->hi = hi64; (base)->lo = lo64 |