summaryrefslogtreecommitdiffstats
path: root/server/util
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:30:02 -0500
commit0f29c921fe2138eadac33803115ad71a3e8715db (patch)
treefe5a6a409469a2c0345a50947ade85cf6e5a608a /server/util
parentb2016c8921421849b67c156b701f0c4ca23b55d6 (diff)
downloadsssd-0f29c921fe2138eadac33803115ad71a3e8715db.tar.gz
sssd-0f29c921fe2138eadac33803115ad71a3e8715db.tar.xz
sssd-0f29c921fe2138eadac33803115ad71a3e8715db.zip
Change dhash API to be talloc-friendly
Diffstat (limited to 'server/util')
-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;