diff options
author | Stef Walter <stefw@collabora.co.uk> | 2011-01-26 12:46:14 -0600 |
---|---|---|
committer | Stef Walter <stefw@collabora.co.uk> | 2011-01-26 12:46:14 -0600 |
commit | 4375e297b19bc2177e17cc5616e75d96be053328 (patch) | |
tree | e62b542ae6bb600332912e14c480270709934760 /module | |
parent | f8009b4d504de0ed752b867893acd263108409e0 (diff) |
Add testing and start testing hash table functionality.
Diffstat (limited to 'module')
-rw-r--r-- | module/Makefile.am | 16 | ||||
-rw-r--r-- | module/hash.c | 15 | ||||
-rw-r--r-- | module/hash.h | 5 |
3 files changed, 32 insertions, 4 deletions
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 @@ -425,6 +425,21 @@ hash_ulongptr_equal (const void *ulong_one, const void *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) { return (unsigned int)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, |