diff options
author | Andrew Bartlett <abartlet@samba.org> | 2016-06-29 16:41:52 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-07-03 14:26:17 +0200 |
commit | d2a5927bd77a94256f7d8ee7098f66c4c0afd25d (patch) | |
tree | 6542cd9cd004148b07b2e381166431ee56c8aa1f /lib/talloc/talloc.c | |
parent | 94a72849fa5be82c785f71ab58b8e813c94c51cd (diff) | |
download | samba-d2a5927bd77a94256f7d8ee7098f66c4c0afd25d.tar.gz |
lib: talloc: Rename the internals of _talloc_free_internal() to _tc_free_internal().
Make it use a struct talloc_chunk *tc parameter. Define _talloc_free_internal()
in terms of _tc_free_internal().
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/talloc/talloc.c')
-rw-r--r-- | lib/talloc/talloc.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 007b7a42ddb..428fb8aa7ad 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -999,29 +999,16 @@ static inline void _tc_free_children_internal(struct talloc_chunk *tc, void *ptr, const char *location); +static inline int _talloc_free_internal(void *ptr, const char *location); + /* - internal talloc_free call + internal free call that takes a struct talloc_chunk *. */ -static inline int _talloc_free_internal(void *ptr, const char *location) +static inline int _tc_free_internal(struct talloc_chunk *tc, + const char *location) { - struct talloc_chunk *tc; void *ptr_to_free; - - if (unlikely(ptr == NULL)) { - return -1; - } - - /* possibly initialised the talloc fill value */ - if (unlikely(!talloc_fill.initialised)) { - const char *fill = getenv(TALLOC_FILL_ENV); - if (fill != NULL) { - talloc_fill.enabled = true; - talloc_fill.fill_value = strtoul(fill, NULL, 0); - } - talloc_fill.initialised = true; - } - - tc = talloc_chunk_from_ptr(ptr); + void *ptr = TC_PTR_FROM_CHUNK(tc); if (unlikely(tc->refs)) { int is_child; @@ -1125,6 +1112,31 @@ static inline int _talloc_free_internal(void *ptr, const char *location) return 0; } +/* + internal talloc_free call +*/ +static inline int _talloc_free_internal(void *ptr, const char *location) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return -1; + } + + /* possibly initialised the talloc fill value */ + if (unlikely(!talloc_fill.initialised)) { + const char *fill = getenv(TALLOC_FILL_ENV); + if (fill != NULL) { + talloc_fill.enabled = true; + talloc_fill.fill_value = strtoul(fill, NULL, 0); + } + talloc_fill.initialised = true; + } + + tc = talloc_chunk_from_ptr(ptr); + return _tc_free_internal(tc, location); +} + static inline size_t _talloc_total_limit_size(const void *ptr, struct talloc_memlimit *old_limit, struct talloc_memlimit *new_limit); |