From 603f59bcb502c48eb577bc6fd3232a6944756983 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 4 Nov 2008 17:32:14 -0500 Subject: Rename function, do not use other libraries namespace --- server/util/memory.c | 19 ++++++++++++------- server/util/util.h | 6 ++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/server/util/memory.c b/server/util/memory.c index cf653260..a25aa787 100644 --- a/server/util/memory.c +++ b/server/util/memory.c @@ -1,26 +1,31 @@ -#include "util/util.h" +#include "replace.h" +#include "talloc.h" /* - * talloc_takeover + * sssd_mem_takeover * This function will take a non-talloc pointer and add it to a talloc * memory context. It will accept a destructor for the original pointer * so that when the parent memory context is freed, the non-talloc * pointer will also be freed properly. */ -TALLOC_CTX *talloc_takeover(TALLOC_CTX *mem_ctx, void *ptr, int (*destructor)(void **)) { - void **handle; +TALLOC_CTX *sssd_mem_takeover(TALLOC_CTX *mem_ctx, + void *ptr, + int (*destructor)(void **)) +{ + TALLOC_CTX **handle; if (ptr == NULL) { return NULL; } - handle = talloc_named_const(mem_ctx, sizeof(void *), "void *"); + handle = talloc_named_const(mem_ctx, sizeof(void *), + "sssd_mem_takeover destructor handle"); if (handle == NULL) { return NULL; } *handle = ptr; - talloc_set_destructor(handle,destructor); + talloc_set_destructor(handle, destructor); return handle; -} \ No newline at end of file +} diff --git a/server/util/util.h b/server/util/util.h index 1613c9ef..bb5526e4 100644 --- a/server/util/util.h +++ b/server/util/util.h @@ -44,6 +44,8 @@ void CatchChild(void); void CatchChildLeaveStatus(void); /* from memory.c */ -//TALLOC_CTX *talloc_takeover(TALLOC_CTX *mem_ctx, void *ptr, int (*destructor)(void *), const char *type); -TALLOC_CTX *talloc_takeover(TALLOC_CTX *mem_ctx, void *ptr, int (*destructor)(void **)); +TALLOC_CTX *sssd_mem_takeover(TALLOC_CTX *mem_ctx, + void *ptr, + int (*destructor)(void **)); + #endif /* __SSSD_UTIL_H__ */ -- cgit