From 4375e297b19bc2177e17cc5616e75d96be053328 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 26 Jan 2011 12:46:14 -0600 Subject: Add testing and start testing hash table functionality. --- module/Makefile.am | 16 ++++++++++++---- module/hash.c | 15 +++++++++++++++ module/hash.h | 5 +++++ 3 files changed, 32 insertions(+), 4 deletions(-) (limited to 'module') diff --git a/module/Makefile.am b/module/Makefile.am index c3fcad2..6103485 100644 --- a/module/Makefile.am +++ b/module/Makefile.am @@ -10,13 +10,21 @@ MODULE_SRCS = \ p11-kit-proxy.c \ p11-kit-private.h p11-kit.h -lib_LTLIBRARIES = p11-kit.la +lib_LTLIBRARIES = \ + libp11-kit.la -p11_kit_la_LDFLAGS = \ - -module -avoid-version \ +noinst_LTLIBRARIES = \ + libp11-kit-testable.la + +libp11_kit_la_LDFLAGS = \ -no-undefined -export-symbols-regex 'C_GetFunctionList' -p11_kit_la_SOURCES = $(MODULE_SRCS) +libp11_kit_la_SOURCES = $(MODULE_SRCS) + +libp11_kit_testable_la_LDFLAGS = \ + -no-undefined + +libp11_kit_testable_la_SOURCES = $(MODULE_SRCS) EXTRA_DIST = \ pkcs11.h \ No newline at end of file diff --git a/module/hash.c b/module/hash.c index 84d57a2..30efced 100644 --- a/module/hash.c +++ b/module/hash.c @@ -424,6 +424,21 @@ hash_ulongptr_equal (const void *ulong_one, const void *ulong_two) return *((unsigned long*)ulong_one) == *((unsigned long*)ulong_two); } +unsigned int +hash_intptr_hash (const void *to_int) +{ + assert (to_int); + return (unsigned int)*((unsigned long*)to_int); +} + +int +hash_intptr_equal (const void *int_one, const void *int_two) +{ + assert (int_one); + assert (int_two); + return *((unsigned long*)int_one) == *((unsigned long*)int_two); +} + unsigned int hash_direct_hash (const void *ptr) { diff --git a/module/hash.h b/module/hash.h index 8649ed5..eb3c496 100644 --- a/module/hash.h +++ b/module/hash.h @@ -174,6 +174,11 @@ unsigned int hash_ulongptr_hash (const void *to_ulong); int hash_ulongptr_equal (const void *ulong_one, const void *ulong_two); +unsigned int hash_intptr_hash (const void *to_int); + +int hash_intptr_equal (const void *int_one, + const void *int_two); + unsigned int hash_direct_hash (const void *ptr); int hash_direct_equal (const void *ptr_one, -- cgit v1.2.3