Convenience macro. I was searching for it few times already, so probably good to just add it.
Unified · Split
| @@ -91,6 +91,9 @@ bool ta_vasprintf_append_buffer(char **str, const char *fmt, va_list ap) TA_PRF( · 90 unmodified lines | ||
| 91 | 91 | #define ta_new_ptrtype(ta_parent, ptr) \ |
| 92 | 92 | (TA_TYPEOF(ptr))ta_alloc_size(ta_parent, sizeof(*ptr)) |
| 93 | 93 | |
| 94 | +#define ta_znew_ptrtype(ta_parent, ptr) \ | |
| 95 | + (TA_TYPEOF(ptr))ta_zalloc_size(ta_parent, sizeof(*ptr)) | |
| 96 | + | |
| 94 | 97 | #define ta_new_array_ptrtype(ta_parent, ptr, count) \ |
| 95 | 98 | (TA_TYPEOF(ptr))ta_new_array_size(ta_parent, sizeof(*(ptr)), count) |
| 96 | 99 | |
| @@ -133,6 +136,7 @@ bool ta_vasprintf_append_buffer(char **str, const char *fmt, va_list ap) TA_PRF( · 36 unmodified lines | ||
| 133 | 136 | #define ta_xznew_array(...) ta_oom_g(ta_znew_array(__VA_ARGS__)) |
| 134 | 137 | #define ta_xnew_array_size(...) ta_oom_p(ta_new_array_size(__VA_ARGS__)) |
| 135 | 138 | #define ta_xnew_ptrtype(...) ta_oom_g(ta_new_ptrtype(__VA_ARGS__)) |
| 139 | +#define ta_xznew_ptrtype(...) ta_oom_g(ta_znew_ptrtype(__VA_ARGS__)) | |
| 136 | 140 | #define ta_xnew_array_ptrtype(...) ta_oom_g(ta_new_array_ptrtype(__VA_ARGS__)) |
| 137 | 141 | #define ta_xdup(...) ta_oom_g(ta_dup(__VA_ARGS__)) |
| 138 | 142 | |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | #define talloc_array_size ta_xnew_array_size |
| 33 | 33 | #define talloc_realloc ta_xrealloc |
| 34 | 34 | #define talloc_ptrtype ta_xnew_ptrtype |
| 35 | +#define talloc_zero_ptrtype ta_xznew_ptrtype | |
| 35 | 36 | #define talloc_array_ptrtype ta_xnew_array_ptrtype |
| 36 | 37 | |
| 37 | 38 | #define talloc_steal ta_steal |