diff options
author | Andrew Bartlett <abartlet@samba.org> | 2016-06-17 17:06:52 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-07-03 14:26:17 +0200 |
commit | 5bc592da83ebea1bc425ca4c7cc1f7a9d083814a (patch) | |
tree | 32c2ff17ee313bd2ffa8ed8f5045c77f245e0099 /lib | |
parent | 58f987d0e6c47fe8bbb270a299af3021f7aeef00 (diff) | |
download | samba-5bc592da83ebea1bc425ca4c7cc1f7a9d083814a.tar.gz |
lib: talloc: Change __talloc() to return a struct talloc_chunk *.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/talloc/talloc.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 3873fa6bc1f..1c09fb69fe3 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -706,10 +706,11 @@ static inline void *__talloc_with_prefix(const void *context, return TC_PTR_FROM_CHUNK(tc); } -static inline void *__talloc(const void *context, size_t size) +static inline void *__talloc(const void *context, + size_t size, + struct talloc_chunk **tc) { - struct talloc_chunk *tc; - return __talloc_with_prefix(context, size, 0, &tc); + return __talloc_with_prefix(context, size, 0, tc); } /* @@ -864,8 +865,9 @@ static inline void _talloc_set_name_const(const void *ptr, const char *name) static inline void *_talloc_named_const(const void *context, size_t size, const char *name) { void *ptr; + struct talloc_chunk *tc; - ptr = __talloc(context, size); + ptr = __talloc(context, size, &tc); if (unlikely(ptr == NULL)) { return NULL; } @@ -1398,8 +1400,9 @@ _PUBLIC_ void *talloc_named(const void *context, size_t size, const char *fmt, . va_list ap; void *ptr; const char *name; + struct talloc_chunk *tc; - ptr = __talloc(context, size); + ptr = __talloc(context, size, &tc); if (unlikely(ptr == NULL)) return NULL; va_start(ap, fmt); @@ -1493,8 +1496,9 @@ _PUBLIC_ void *talloc_init(const char *fmt, ...) va_list ap; void *ptr; const char *name; + struct talloc_chunk *tc; - ptr = __talloc(NULL, 0); + ptr = __talloc(NULL, 0, &tc); if (unlikely(ptr == NULL)) return NULL; va_start(ap, fmt); @@ -1588,7 +1592,8 @@ _PUBLIC_ void talloc_free_children(void *ptr) */ _PUBLIC_ void *_talloc(const void *context, size_t size) { - return __talloc(context, size); + struct talloc_chunk *tc; + return __talloc(context, size, &tc); } /* @@ -2298,8 +2303,9 @@ _PUBLIC_ void *_talloc_memdup(const void *t, const void *p, size_t size, const c static inline char *__talloc_strlendup(const void *t, const char *p, size_t len) { char *ret; + struct talloc_chunk *tc; - ret = (char *)__talloc(t, len + 1); + ret = (char *)__talloc(t, len + 1, &tc); if (unlikely(!ret)) return NULL; memcpy(ret, p, len); @@ -2436,6 +2442,7 @@ _PUBLIC_ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) int len; char *ret; va_list ap2; + struct talloc_chunk *tc; char buf[1024]; /* this call looks strange, but it makes it work on older solaris boxes */ @@ -2446,7 +2453,7 @@ _PUBLIC_ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) return NULL; } - ret = (char *)__talloc(t, len+1); + ret = (char *)__talloc(t, len+1, &tc); if (unlikely(!ret)) return NULL; if (len < sizeof(buf)) { |