summaryrefslogtreecommitdiff
path: root/source4/lib/talloc/talloc.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-08-28 18:21:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:53 -0500
commit59057c8d56629a941ab412fa195dea7c8c486b21 (patch)
tree0ce8b1b713f7c95a70801b1074654c4187c37728 /source4/lib/talloc/talloc.c
parent3ddab071eb81023fa99e69d0a8a2d696cf56db70 (diff)
downloadsamba-59057c8d56629a941ab412fa195dea7c8c486b21.tar.gz
samba-59057c8d56629a941ab412fa195dea7c8c486b21.tar.bz2
samba-59057c8d56629a941ab412fa195dea7c8c486b21.zip
r17895: - talloc_increase_ref_count() can fail
- make talloc_reference() typesafe when gcc >= 3 is used metze (This used to be commit 933d1b47ad614d02cc02b602e704948b342febdb)
Diffstat (limited to 'source4/lib/talloc/talloc.c')
-rw-r--r--source4/lib/talloc/talloc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c
index cc04a2425a..ba457afd6b 100644
--- a/source4/lib/talloc/talloc.c
+++ b/source4/lib/talloc/talloc.c
@@ -219,9 +219,12 @@ void _talloc_set_destructor(const void *ptr, int (*destructor)(void *))
/*
increase the reference count on a piece of memory.
*/
-void talloc_increase_ref_count(const void *ptr)
+int talloc_increase_ref_count(const void *ptr)
{
- talloc_reference(null_context, ptr);
+ if (!talloc_reference(null_context, ptr)) {
+ return -1;
+ }
+ return 0;
}
/*
@@ -243,7 +246,7 @@ static int talloc_reference_destructor(struct talloc_reference_handle *handle)
same underlying data, and you want to be able to free the two instances separately,
and in either order
*/
-void *talloc_reference(const void *context, const void *ptr)
+void *_talloc_reference(const void *context, const void *ptr)
{
struct talloc_chunk *tc;
struct talloc_reference_handle *handle;