mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
ta: introduce talloc_dup() and use it in some places
It was actually already implemented as ta_dup_ptrtype(), but that seems like a clunky name. Also we still use the talloc_ names throughout the source, and I'd rather use an old name instead of a mixing inconsistent naming conventions.
This commit is contained in:
4
ta/ta.h
4
ta/ta.h
@@ -96,7 +96,7 @@ bool ta_vasprintf_append_buffer(char **str, const char *fmt, va_list ap) TA_PRF(
|
||||
|
||||
#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
|
||||
|
||||
#define ta_dup_ptrtype(ta_parent, ptr) \
|
||||
#define ta_dup(ta_parent, ptr) \
|
||||
(TA_TYPEOF(ptr))ta_memdup(ta_parent, ptr, sizeof(*(ptr)))
|
||||
|
||||
// Ugly macros that crash on OOM.
|
||||
@@ -126,7 +126,7 @@ bool ta_vasprintf_append_buffer(char **str, const char *fmt, va_list ap) TA_PRF(
|
||||
#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_array_ptrtype(...) ta_oom_g(ta_new_array_ptrtype(__VA_ARGS__))
|
||||
#define ta_xdup_ptrtype(...) ta_oom_g(ta_dup_ptrtype(__VA_ARGS__))
|
||||
#define ta_xdup(...) ta_oom_g(ta_dup(__VA_ARGS__))
|
||||
|
||||
#define ta_xsteal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_xsteal_(ta_parent, ptr)
|
||||
#define ta_xrealloc(ta_parent, ptr, type, count) \
|
||||
|
||||
Reference in New Issue
Block a user