summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-12-08 11:06:42 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-12-08 12:31:46 -0500
commit202bd8e4d0a4b7e3d09f0eb5a6ac512ff83d9285 (patch)
tree606727dfddc3c6df970703df0ba4c40267474559 /server
parent2313a32ea75f9433e36fc03c6fb83c4eff8379d8 (diff)
downloadsssd-202bd8e4d0a4b7e3d09f0eb5a6ac512ff83d9285.tar.gz
sssd-202bd8e4d0a4b7e3d09f0eb5a6ac512ff83d9285.tar.xz
sssd-202bd8e4d0a4b7e3d09f0eb5a6ac512ff83d9285.zip
Change dhash API to be talloc-friendly
Diffstat (limited to 'server')
-rw-r--r--server/util/find_uid.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/server/util/find_uid.c b/server/util/find_uid.c
index 626d37f6f..09c47b3d8 100644
--- a/server/util/find_uid.c
+++ b/server/util/find_uid.c
@@ -43,23 +43,12 @@
#define PATHLEN (NAME_MAX + 14)
#define BUFSIZE 4096
-TALLOC_CTX *hash_talloc_ctx(TALLOC_CTX *mem_ctx)
+static void *hash_talloc(const size_t size, void *pvt)
{
- static TALLOC_CTX * saved_ctx = NULL;
-
- if (mem_ctx != NULL) {
- saved_ctx = mem_ctx;
- }
-
- return saved_ctx;
-}
-
-void *hash_talloc(const size_t size)
-{
- return talloc_size(hash_talloc_ctx(NULL), size);
+ return talloc_size(pvt, size);
}
-void hash_talloc_free(void *ptr)
+static void hash_talloc_free(void *ptr, void *pvt)
{
talloc_free(ptr);
}
@@ -273,9 +262,8 @@ errno_t get_uid_table(TALLOC_CTX *mem_ctx, hash_table_t **table)
#ifdef __linux__
int ret;
- hash_talloc_ctx(mem_ctx);
ret = hash_create_ex(INITIAL_TABLE_SIZE, table, 0, 0, 0, 0,
- hash_talloc, hash_talloc_free, NULL);
+ hash_talloc, hash_talloc_free, mem_ctx, NULL);
if (ret != HASH_SUCCESS) {
DEBUG(1, ("hash_create_ex failed [%s]\n", hash_error_string(ret)));
return ENOMEM;