mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-22 10:57:08 +00:00
ta: add talloc_zero_ptrtype
Convenience macro. I was searching for it few times already, so probably good to just add it.
This commit is contained in:
4
ta/ta.h
4
ta/ta.h
@@ -91,6 +91,9 @@ bool ta_vasprintf_append_buffer(char **str, const char *fmt, va_list ap) TA_PRF(
|
|||||||
#define ta_new_ptrtype(ta_parent, ptr) \
|
#define ta_new_ptrtype(ta_parent, ptr) \
|
||||||
(TA_TYPEOF(ptr))ta_alloc_size(ta_parent, sizeof(*ptr))
|
(TA_TYPEOF(ptr))ta_alloc_size(ta_parent, sizeof(*ptr))
|
||||||
|
|
||||||
|
#define ta_znew_ptrtype(ta_parent, ptr) \
|
||||||
|
(TA_TYPEOF(ptr))ta_zalloc_size(ta_parent, sizeof(*ptr))
|
||||||
|
|
||||||
#define ta_new_array_ptrtype(ta_parent, ptr, count) \
|
#define ta_new_array_ptrtype(ta_parent, ptr, count) \
|
||||||
(TA_TYPEOF(ptr))ta_new_array_size(ta_parent, sizeof(*(ptr)), count)
|
(TA_TYPEOF(ptr))ta_new_array_size(ta_parent, sizeof(*(ptr)), count)
|
||||||
|
|
||||||
@@ -133,6 +136,7 @@ bool ta_vasprintf_append_buffer(char **str, const char *fmt, va_list ap) TA_PRF(
|
|||||||
#define ta_xznew_array(...) ta_oom_g(ta_znew_array(__VA_ARGS__))
|
#define ta_xznew_array(...) ta_oom_g(ta_znew_array(__VA_ARGS__))
|
||||||
#define ta_xnew_array_size(...) ta_oom_p(ta_new_array_size(__VA_ARGS__))
|
#define ta_xnew_array_size(...) ta_oom_p(ta_new_array_size(__VA_ARGS__))
|
||||||
#define ta_xnew_ptrtype(...) ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
|
#define ta_xnew_ptrtype(...) ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
|
||||||
|
#define ta_xznew_ptrtype(...) ta_oom_g(ta_znew_ptrtype(__VA_ARGS__))
|
||||||
#define ta_xnew_array_ptrtype(...) ta_oom_g(ta_new_array_ptrtype(__VA_ARGS__))
|
#define ta_xnew_array_ptrtype(...) ta_oom_g(ta_new_array_ptrtype(__VA_ARGS__))
|
||||||
#define ta_xdup(...) ta_oom_g(ta_dup(__VA_ARGS__))
|
#define ta_xdup(...) ta_oom_g(ta_dup(__VA_ARGS__))
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#define talloc_array_size ta_xnew_array_size
|
#define talloc_array_size ta_xnew_array_size
|
||||||
#define talloc_realloc ta_xrealloc
|
#define talloc_realloc ta_xrealloc
|
||||||
#define talloc_ptrtype ta_xnew_ptrtype
|
#define talloc_ptrtype ta_xnew_ptrtype
|
||||||
|
#define talloc_zero_ptrtype ta_xznew_ptrtype
|
||||||
#define talloc_array_ptrtype ta_xnew_array_ptrtype
|
#define talloc_array_ptrtype ta_xnew_array_ptrtype
|
||||||
|
|
||||||
#define talloc_steal ta_steal
|
#define talloc_steal ta_steal
|
||||||
|
|||||||
Reference in New Issue
Block a user