History

ta: add talloc_zero_ptrtype

Convenience macro. I was searching for it few times already, so probably good to just add it.

Kacper Michajłow committed 1 year ago

Commit 844507a1 parent ae3420f2 files · +5 −0Browse files

Unified · Split

2 files
  1. ta/ta.h +4 −0
  2. ta/ta_talloc.h +1 −0
ta/ta.h+4−0
@@ -91,6 +91,9 @@ bool ta_vasprintf_append_buffer(char **str, const char *fmt, va_list ap) TA_PRF( · 90 unmodified lines
91#define ta_new_ptrtype(ta_parent, ptr) \91#define ta_new_ptrtype(ta_parent, ptr) \
92 (TA_TYPEOF(ptr))ta_alloc_size(ta_parent, sizeof(*ptr))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#define ta_new_array_ptrtype(ta_parent, ptr, count) \97#define ta_new_array_ptrtype(ta_parent, ptr, count) \
95 (TA_TYPEOF(ptr))ta_new_array_size(ta_parent, sizeof(*(ptr)), count)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#define ta_xznew_array(...) ta_oom_g(ta_znew_array(__VA_ARGS__))136#define ta_xznew_array(...) ta_oom_g(ta_znew_array(__VA_ARGS__))
134#define ta_xnew_array_size(...) ta_oom_p(ta_new_array_size(__VA_ARGS__))137#define ta_xnew_array_size(...) ta_oom_p(ta_new_array_size(__VA_ARGS__))
135#define ta_xnew_ptrtype(...) ta_oom_g(ta_new_ptrtype(__VA_ARGS__))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#define ta_xnew_array_ptrtype(...) ta_oom_g(ta_new_array_ptrtype(__VA_ARGS__))140#define ta_xnew_array_ptrtype(...) ta_oom_g(ta_new_array_ptrtype(__VA_ARGS__))
137#define ta_xdup(...) ta_oom_g(ta_dup(__VA_ARGS__))141#define ta_xdup(...) ta_oom_g(ta_dup(__VA_ARGS__))
138 142
ta/ta_talloc.h+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
32#define talloc_array_size ta_xnew_array_size32#define talloc_array_size ta_xnew_array_size
33#define talloc_realloc ta_xrealloc33#define talloc_realloc ta_xrealloc
34#define talloc_ptrtype ta_xnew_ptrtype34#define talloc_ptrtype ta_xnew_ptrtype
35#define talloc_zero_ptrtype ta_xznew_ptrtype
35#define talloc_array_ptrtype ta_xnew_array_ptrtype36#define talloc_array_ptrtype ta_xnew_array_ptrtype
36 37
37#define talloc_steal ta_steal38#define talloc_steal ta_steal

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t