summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-11-10 10:20:08 +0100
committerThomas Graf <tgraf@suug.ch>2012-11-10 10:22:26 +0100
commit5641c0ea6156fc04abc3c843cf11657718eced68 (patch)
tree6bcd414bba20f215f77fe908fcf4192c67717854
parenta2207c7beb80050671d209650aaaeba429658e49 (diff)
downloadlibnl-5641c0ea6156fc04abc3c843cf11657718eced68.tar.gz
Hash: Properly prefix hash functions
Do not pollute public namespace with unprefixed functions. Signed-off-by: Thomas Graf <tgraf@suug.ch>
-rw-r--r--include/netlink/hash.h8
-rw-r--r--lib/hash.c2
-rw-r--r--lib/hashtable.c2
3 files changed, 6 insertions, 6 deletions
diff --git a/include/netlink/hash.h b/include/netlink/hash.h
index 8ca1f5b..0bda74e 100644
--- a/include/netlink/hash.h
+++ b/include/netlink/hash.h
@@ -55,15 +55,15 @@
* if (argc != 3)
* err(1, "Usage: %s <string1> <string2>", argv[0]);
*
- * hash1 = hash(argv[1], strlen(argv[1]), 0);
- * hash2 = hash(argv[2], strlen(argv[2]), 0);
+ * hash1 = __nl_hash(argv[1], strlen(argv[1]), 0);
+ * hash2 = __nl_hash(argv[2], strlen(argv[2]), 0);
* printf("Hash is %s\n", hash1 == hash2 ? "same" : "different");
* return 0;
* }
*/
-#define hash(p, num, base) hash_any((p), (num)*sizeof(*(p)), (base))
+#define __nl_hash(p, num, base) nl_hash_any((p), (num)*sizeof(*(p)), (base))
/* Our underlying operations. */
-uint32_t hash_any(const void *key, size_t length, uint32_t base);
+uint32_t nl_hash_any(const void *key, size_t length, uint32_t base);
#endif /* HASH_H */
diff --git a/lib/hash.c b/lib/hash.c
index 6fdf2b8..47c938b 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -473,7 +473,7 @@ static uint32_t hashbig( const void *key, size_t length, uint32_t *val2)
return c;
}
-uint32_t hash_any(const void *key, size_t length, uint32_t base)
+uint32_t nl_hash_any(const void *key, size_t length, uint32_t base)
{
if (HASH_BIG_ENDIAN)
return hashbig(key, length, &base);
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 59cd91e..938f2e4 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -137,5 +137,5 @@ int nl_hash_table_del(nl_hash_table_t *ht, struct nl_object *obj)
uint32_t nl_hash(void *k, size_t length, uint32_t initval)
{
- return(hash(k, length, initval));
+ return(__nl_hash(k, length, initval));
}