summaryrefslogtreecommitdiff
path: root/libdm/datastruct
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2011-03-10 12:48:40 +0000
committerZdenek Kabelac <zkabelac@redhat.com>2011-03-10 12:48:40 +0000
commit8b6ce11d0239d6927ea4c9ec6b3b1f519ed106a4 (patch)
tree6c9430dd53539b942e3a87bb1af983da32f1776a /libdm/datastruct
parent3019419e955a212e83e7a6b7e8d1791cd866f0dd (diff)
downloadlvm2-8b6ce11d0239d6927ea4c9ec6b3b1f519ed106a4.tar.gz
Use void pointer instead of char for binary key
dm_hash binary functions takes void* key - so there is no need to cast pointers to char* (also the hash key does not have trailing '\0'). This is slight API change, but presents no change for the API user side it just allows to write code easier as the casting could be removed.
Diffstat (limited to 'libdm/datastruct')
-rw-r--r--libdm/datastruct/hash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c
index d4543df5b..30b4a97ad 100644
--- a/libdm/datastruct/hash.c
+++ b/libdm/datastruct/hash.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
*
* This file is part of the device-mapper userspace tools.
*
@@ -133,7 +133,7 @@ void dm_hash_destroy(struct dm_hash_table *t)
dm_free(t);
}
-static struct dm_hash_node **_find(struct dm_hash_table *t, const char *key,
+static struct dm_hash_node **_find(struct dm_hash_table *t, const void *key,
uint32_t len)
{
unsigned h = _hash(key, len) & (t->num_slots - 1);
@@ -150,15 +150,15 @@ static struct dm_hash_node **_find(struct dm_hash_table *t, const char *key,
return c;
}
-void *dm_hash_lookup_binary(struct dm_hash_table *t, const char *key,
- uint32_t len)
+void *dm_hash_lookup_binary(struct dm_hash_table *t, const void *key,
+ uint32_t len)
{
struct dm_hash_node **c = _find(t, key, len);
return *c ? (*c)->data : 0;
}
-int dm_hash_insert_binary(struct dm_hash_table *t, const char *key,
+int dm_hash_insert_binary(struct dm_hash_table *t, const void *key,
uint32_t len, void *data)
{
struct dm_hash_node **c = _find(t, key, len);
@@ -180,7 +180,7 @@ int dm_hash_insert_binary(struct dm_hash_table *t, const char *key,
return 1;
}
-void dm_hash_remove_binary(struct dm_hash_table *t, const char *key,
+void dm_hash_remove_binary(struct dm_hash_table *t, const void *key,
uint32_t len)
{
struct dm_hash_node **c = _find(t, key, len);