diff options
author | Stef Walter <stefw@collabora.co.uk> | 2011-10-24 08:05:43 +0200 |
---|---|---|
committer | Stef Walter <stefw@collabora.co.uk> | 2011-10-24 08:05:43 +0200 |
commit | 5507dc4946f0a68cece5ec9e7096e0f9b8c55984 (patch) | |
tree | d3921c57fabb04aceedf052d051ffa77f22f4b1e /p11-kit | |
parent | db92b76e3acb11e330309ebce071ec2e61400a71 (diff) |
Rename non-static functions to have a _p11_xxx prefix.
* Work around issues with brain-dead linkers not respecting
the libtool -export-symbol-regex argument
https://bugs.freedesktop.org/show_bug.cgi?id=42020
Diffstat (limited to 'p11-kit')
-rw-r--r-- | p11-kit/compat.c | 8 | ||||
-rw-r--r-- | p11-kit/compat.h | 48 | ||||
-rw-r--r-- | p11-kit/conf.c | 36 | ||||
-rw-r--r-- | p11-kit/debug.c | 17 | ||||
-rw-r--r-- | p11-kit/debug.h | 12 | ||||
-rw-r--r-- | p11-kit/hashmap.c | 68 | ||||
-rw-r--r-- | p11-kit/hashmap.h | 63 | ||||
-rw-r--r-- | p11-kit/modules.c | 110 | ||||
-rw-r--r-- | p11-kit/pin.c | 40 | ||||
-rw-r--r-- | p11-kit/private.h | 4 | ||||
-rw-r--r-- | p11-kit/proxy.c | 18 | ||||
-rw-r--r-- | p11-kit/ptr-array.c | 28 | ||||
-rw-r--r-- | p11-kit/ptr-array.h | 14 | ||||
-rw-r--r-- | p11-kit/uri.c | 2 | ||||
-rw-r--r-- | p11-kit/util.c | 12 | ||||
-rw-r--r-- | p11-kit/util.h | 2 |
16 files changed, 252 insertions, 230 deletions
diff --git a/p11-kit/compat.c b/p11-kit/compat.c index 5fe8a84..db0b0ce 100644 --- a/p11-kit/compat.c +++ b/p11-kit/compat.c @@ -42,7 +42,7 @@ #ifdef OS_UNIX void -mutex_init (mutex_t *mutex) +_p11_mutex_init (mutex_t *mutex) { pthread_mutexattr_t attr; int ret; @@ -59,7 +59,7 @@ mutex_init (mutex_t *mutex) #ifdef OS_WIN32 const char * -module_error (void) +_p11_module_error (void) { DWORD code = GetLastError(); p11_local *local; @@ -82,7 +82,7 @@ module_error (void) } int -thread_create (thread_t *thread, +_p11_thread_create (thread_t *thread, thread_routine routine, void *arg) { @@ -99,7 +99,7 @@ thread_create (thread_t *thread, } int -thread_join (thread_t thread) +_p11_thread_join (thread_t thread) { DWORD res; diff --git a/p11-kit/compat.h b/p11-kit/compat.h index 4972b19..39dd67e 100644 --- a/p11-kit/compat.h +++ b/p11-kit/compat.h @@ -55,36 +55,36 @@ typedef CRITICAL_SECTION mutex_t; typedef HANDLE thread_t; -#define mutex_init(m) \ +#define _p11_mutex_init(m) \ (InitializeCriticalSection (m)) -#define mutex_lock(m) \ +#define _p11_mutex_lock(m) \ (EnterCriticalSection (m)) -#define mutex_unlock(m) \ +#define _p11_mutex_unlock(m) \ (LeaveCriticalSection (m)) -#define mutex_uninit(m) \ +#define _p11_mutex_uninit(m) \ (DeleteCriticalSection (m)) typedef void * (*thread_routine) (void *arg); -int thread_create (thread_t *thread, thread_routine, void *arg); +int _p11_thread_create (thread_t *thread, thread_routine, void *arg); -int thread_join (thread_t thread); +int _p11_thread_join (thread_t thread); -#define thread_self() \ +#define _p11_thread_self() \ (GetCurrentThread ()) typedef HMODULE dl_module_t; -#define module_open(f) \ +#define _p11_module_open(f) \ (LoadLibrary (f)) -#define module_close(d) \ +#define _p11_module_close(d) \ (FreeLibrary (d)) -#define module_symbol(d, s) \ +#define _p11_module_symbol(d, s) \ ((void *)GetProcAddress ((d), (s))) -const char * module_error (void); +const char * _p11_module_error (void); -#define sleep_ms(ms) \ +#define _p11_sleep_ms(ms) \ (Sleep (ms)) #endif /* OS_WIN32 */ @@ -101,38 +101,38 @@ const char * module_error (void); typedef pthread_mutex_t mutex_t; -void mutex_init (mutex_t *mutex); +void _p11_mutex_init (mutex_t *mutex); -#define mutex_lock(m) \ +#define _p11_mutex_lock(m) \ (pthread_mutex_lock (m)) -#define mutex_unlock(m) \ +#define _p11_mutex_unlock(m) \ (pthread_mutex_unlock (m)) -#define mutex_uninit(m) \ +#define _p11_mutex_uninit(m) \ (pthread_mutex_destroy(m)) typedef pthread_t thread_t; typedef void * (*thread_routine) (void *arg); -#define thread_create(t, r, a) \ +#define _p11_thread_create(t, r, a) \ (pthread_create ((t), NULL, (r), (a))) -#define thread_join(t) \ +#define _p11_thread_join(t) \ (pthread_join ((t), NULL)) -#define thread_self(m) \ +#define _p11_thread_self(m) \ (pthread_self ()) typedef void * dl_module_t; -#define module_open(f) \ +#define _p11_module_open(f) \ (dlopen ((f), RTLD_LOCAL | RTLD_NOW)) -#define module_close(d) \ +#define _p11_module_close(d) \ (dlclose(d)) -#define module_error() \ +#define _p11_module_error() \ (dlerror ()) -#define module_symbol(d, s) \ +#define _p11_module_symbol(d, s) \ (dlsym ((d), (s))) -#define sleep_ms(ms) \ +#define _p11_sleep_ms(ms) \ do { int _ms = (ms); \ struct timespec _ts = { _ms / 1000, (_ms % 1000) * 1000 * 1000 }; \ nanosleep (&_ts, NULL); \ diff --git a/p11-kit/conf.c b/p11-kit/conf.c index b05c8aa..d607bfd 100644 --- a/p11-kit/conf.c +++ b/p11-kit/conf.c @@ -220,10 +220,10 @@ _p11_conf_merge_defaults (hashmap *map, hashmap *defaults) void *key; void *value; - hash_iterate (defaults, &iter); - while (hash_next (&iter, &key, &value)) { + _p11_hash_iterate (defaults, &iter); + while (_p11_hash_next (&iter, &key, &value)) { /* Only override if not set */ - if (hash_get (map, key)) + if (_p11_hash_get (map, key)) continue; key = strdup (key); if (key == NULL) { @@ -236,7 +236,7 @@ _p11_conf_merge_defaults (hashmap *map, hashmap *defaults) errno = ENOMEM; return -1; } - if (!hash_set (map, key, value)) { + if (!_p11_hash_set (map, key, value)) { free (key); free (value); errno = ENOMEM; @@ -269,7 +269,7 @@ _p11_conf_parse_file (const char* filename, int flags) if (!data) return NULL; - map = hash_create (hash_string_hash, hash_string_equal, free, free); + map = _p11_hash_create (_p11_hash_string_hash, _p11_hash_string_equal, free, free); if (map == NULL) { free (data); errno = ENOMEM; @@ -316,7 +316,7 @@ _p11_conf_parse_file (const char* filename, int flags) debug ("config value: %s: %s", name, value); - if (!hash_set (map, name, value)) { + if (!_p11_hash_set (map, name, value)) { free (name); free (value); error = ENOMEM; @@ -327,7 +327,7 @@ _p11_conf_parse_file (const char* filename, int flags) free (data); if (error != 0) { - hash_free (map); + _p11_hash_free (map); map = NULL; errno = error; } @@ -384,7 +384,7 @@ user_config_mode (hashmap *config, int defmode) const char *mode; /* Whether we should use or override from user directory */ - mode = hash_get (config, "user-config"); + mode = _p11_hash_get (config, "user-config"); if (mode == NULL) { return defmode; } else if (strequal (mode, "none")) { @@ -462,7 +462,7 @@ _p11_conf_load_globals (const char *system_conf, const char *user_conf, /* If user config valid at all, then replace system with what we have */ if (mode != CONF_USER_NONE) { - hash_free (config); + _p11_hash_free (config); config = uconfig; uconfig = NULL; } @@ -476,8 +476,8 @@ _p11_conf_load_globals (const char *system_conf, const char *user_conf, finished: free (path); - hash_free (config); - hash_free (uconfig); + _p11_hash_free (config); + _p11_hash_free (uconfig); errno = error; return result; } @@ -496,12 +496,12 @@ load_config_from_file (const char *configfile, const char *name, hashmap *config if (!config) return -1; - prev = hash_get (configs, name); + prev = _p11_hash_get (configs, name); if (prev == NULL) { key = strdup (name); if (key == NULL) error = ENOMEM; - else if (!hash_set (configs, key, config)) + else if (!_p11_hash_set (configs, key, config)) error = errno; else config = NULL; @@ -511,7 +511,7 @@ load_config_from_file (const char *configfile, const char *name, hashmap *config } /* If still set */ - hash_free (config); + _p11_hash_free (config); if (error) { errno = error; @@ -598,8 +598,8 @@ _p11_conf_load_modules (int mode, const char *system_dir, const char *user_dir) int error = 0; /* A hash table of name -> config */ - configs = hash_create (hash_string_hash, hash_string_equal, - free, (hash_destroy_func)hash_free); + configs = _p11_hash_create (_p11_hash_string_hash, _p11_hash_string_equal, + free, (hash_destroy_func)_p11_hash_free); /* Load each user config first, if user config is allowed */ if (mode != CONF_USER_NONE) { @@ -610,7 +610,7 @@ _p11_conf_load_modules (int mode, const char *system_dir, const char *user_dir) error = errno; free (path); if (error != 0) { - hash_free (configs); + _p11_hash_free (configs); errno = error; return NULL; } @@ -624,7 +624,7 @@ _p11_conf_load_modules (int mode, const char *system_dir, const char *user_dir) if (mode != CONF_USER_ONLY) { if (load_configs_from_directory (system_dir, configs) < 0) { error = errno; - hash_free (configs); + _p11_hash_free (configs); errno = error; return NULL; } diff --git a/p11-kit/debug.c b/p11-kit/debug.c index 5766dae..b332407 100644 --- a/p11-kit/debug.c +++ b/p11-kit/debug.c @@ -63,7 +63,7 @@ static int debug_inited = 0; static mutex_t debug_mutex; /* global variable exported in debug.h */ -int debug_current_flags; +int _p11_debug_current_flags = ~0; static int parse_environ_flags (void) @@ -111,23 +111,24 @@ parse_environ_flags (void) } void -debug_init (void) +_p11_debug_init (void) { - debug_current_flags = parse_environ_flags (); - mutex_init (&debug_mutex); + _p11_debug_current_flags = parse_environ_flags (); + _p11_mutex_init (&debug_mutex); debug_inited = 1; } void -debug_message (int flag, const char *format, ...) +_p11_debug_message (int flag, + const char *format, ...) { char buffer[512]; va_list args; assert (debug_inited); - mutex_lock (&debug_mutex); + _p11_mutex_lock (&debug_mutex); - if (flag & debug_current_flags) { + if (flag & _p11_debug_current_flags) { va_start (args, format); vsnprintf (buffer, sizeof (buffer), format, args); buffer[sizeof (buffer) -1] = 0; @@ -135,5 +136,5 @@ debug_message (int flag, const char *format, ...) fprintf (stderr, "(p11-kit:%d) %s\n", getpid(), buffer); } - mutex_unlock (&debug_mutex); + _p11_mutex_unlock (&debug_mutex); } diff --git a/p11-kit/debug.h b/p11-kit/debug.h index b8490dd..fab6800 100644 --- a/p11-kit/debug.h +++ b/p11-kit/debug.h @@ -43,11 +43,11 @@ typedef enum { DEBUG_PROXY = 1 << 4, } DebugFlags; -extern int debug_current_flags; +extern int _p11_debug_current_flags; -void debug_init (void); +void _p11_debug_init (void); -void debug_message (int flag, +void _p11_debug_message (int flag, const char *format, ...); @@ -75,13 +75,13 @@ void debug_message (int flag, #undef debug #define debug(format, ...) do { \ - if (DEBUG_FLAG & debug_current_flags) \ - debug_message (DEBUG_FLAG, "%s: " format, __PRETTY_FUNCTION__, ##__VA_ARGS__); \ + if (DEBUG_FLAG & _p11_debug_current_flags) \ + _p11_debug_message (DEBUG_FLAG, "%s: " format, __PRETTY_FUNCTION__, ##__VA_ARGS__); \ } while (0) #undef debugging #define debugging \ - (DEBUG_FLAG & debug_current_flags) + (DEBUG_FLAG & _p11_debug_current_flags) #else /* !defined (WITH_DEBUG) */ diff --git a/p11-kit/hashmap.c b/p11-kit/hashmap.c index 518a984..6e91c32 100644 --- a/p11-kit/hashmap.c +++ b/p11-kit/hashmap.c @@ -74,7 +74,9 @@ next_entry (hashiter *iter) int -hash_next (hashiter *iter, void **key, void **value) +_p11_hash_next (hashiter *iter, + void **key, + void **value) { hashbucket *bucket = next_entry (iter); if (bucket == NULL) @@ -87,7 +89,8 @@ hash_next (hashiter *iter, void **key, void **value) } void -hash_iterate (hashmap *map, hashiter *iter) +_p11_hash_iterate (hashmap *map, + hashiter *iter) { iter->map = map; iter->index = 0; @@ -95,7 +98,9 @@ hash_iterate (hashmap *map, hashiter *iter) } static hashbucket ** -lookup_or_create_bucket (hashmap *map, const void *key, int create) +lookup_or_create_bucket (hashmap *map, + const void *key, + int create) { hashbucket **bucketp; unsigned int hash; @@ -125,8 +130,9 @@ lookup_or_create_bucket (hashmap *map, const void *key, int create) return bucketp; } -void* -hash_get (hashmap *map, const void *key) +void * +_p11_hash_get (hashmap *map, + const void *key) { hashbucket **bucketp; @@ -138,7 +144,9 @@ hash_get (hashmap *map, const void *key) } int -hash_set (hashmap *map, void *key, void *val) +_p11_hash_set (hashmap *map, + void *key, + void *val) { hashbucket **bucketp; hashiter iter; @@ -164,7 +172,7 @@ hash_set (hashmap *map, void *key, void *val) /* Ignore failures, maybe we can expand later */ if(new_buckets) { - hash_iterate (map, &iter); + _p11_hash_iterate (map, &iter); while ((bucket = next_entry (&iter)) != NULL) { unsigned int i = bucket->hashed & num_buckets; bucket->next = new_buckets[i]; @@ -184,7 +192,10 @@ hash_set (hashmap *map, void *key, void *val) } int -hash_steal (hashmap *map, const void *key, void **stolen_key, void **stolen_value) +_p11_hash_steal (hashmap *map, + const void *key, + void **stolen_key, + void **stolen_value) { hashbucket **bucketp; @@ -206,12 +217,13 @@ hash_steal (hashmap *map, const void *key, void **stolen_key, void **stolen_valu } int -hash_remove (hashmap *map, const void *key) +_p11_hash_remove (hashmap *map, + const void *key) { void *old_key; void *old_value; - if (!hash_steal (map, key, &old_key, &old_value)) + if (!_p11_hash_steal (map, key, &old_key, &old_value)) return 0; if (map->key_destroy_func) @@ -222,7 +234,7 @@ hash_remove (hashmap *map, const void *key) } void -hash_clear (hashmap *map) +_p11_hash_clear (hashmap *map) { hashbucket *bucket, *next; int i; @@ -246,10 +258,10 @@ hash_clear (hashmap *map) } hashmap * -hash_create (hash_hash_func hash_func, - hash_equal_func equal_func, - hash_destroy_func key_destroy_func, - hash_destroy_func value_destroy_func) +_p11_hash_create (hash_hash_func hash_func, + hash_equal_func equal_func, + hash_destroy_func key_destroy_func, + hash_destroy_func value_destroy_func) { hashmap *map; @@ -278,7 +290,7 @@ hash_create (hash_hash_func hash_func, } void -hash_free (hashmap *map) +_p11_hash_free (hashmap *map) { hashbucket *bucket; hashiter iter; @@ -286,7 +298,7 @@ hash_free (hashmap *map) if (!map) return; - hash_iterate (map, &iter); + _p11_hash_iterate (map, &iter); while ((bucket = next_entry (&iter)) != NULL) { if (map->key_destroy_func) map->key_destroy_func (bucket->key); @@ -302,13 +314,13 @@ hash_free (hashmap *map) } unsigned int -hash_size (hashmap *map) +_p11_hash_size (hashmap *map) { return map->num_items; } unsigned int -hash_string_hash (const void *string) +_p11_hash_string_hash (const void *string) { const char *p = string; unsigned int hash = *p; @@ -321,7 +333,8 @@ hash_string_hash (const void *string) } int -hash_string_equal (const void *string_one, const void *string_two) +_p11_hash_string_equal (const void *string_one, + const void *string_two) { assert (string_one); assert (string_two); @@ -330,14 +343,15 @@ hash_string_equal (const void *string_one, const void *string_two) } unsigned int -hash_ulongptr_hash (const void *to_ulong) +_p11_hash_ulongptr_hash (const void *to_ulong) { assert (to_ulong); return (unsigned int)*((unsigned long*)to_ulong); } int -hash_ulongptr_equal (const void *ulong_one, const void *ulong_two) +_p11_hash_ulongptr_equal (const void *ulong_one, + const void *ulong_two) { assert (ulong_one); assert (ulong_two); @@ -345,14 +359,15 @@ hash_ulongptr_equal (const void *ulong_one, const void *ulong_two) } unsigned int -hash_intptr_hash (const void *to_int) +_p11_hash_intptr_hash (const void *to_int) { assert (to_int); return (unsigned int)*((int*)to_int); } int -hash_intptr_equal (const void *int_one, const void *int_two) +_p11_hash_intptr_equal (const void *int_one, + const void *int_two) { assert (int_one); assert (int_two); @@ -360,13 +375,14 @@ hash_intptr_equal (const void *int_one, const void *int_two) } unsigned int -hash_direct_hash (const void *ptr) +_p11_hash_direct_hash (const void *ptr) { return (unsigned int)(unsigned long)ptr; } int -hash_direct_equal (const void *ptr_one, const void *ptr_two) +_p11_hash_direct_equal (const void *ptr_one, + const void *ptr_two) { return ptr_one == ptr_two; } diff --git a/p11-kit/hashmap.h b/p11-kit/hashmap.h index a9292b7..3b35487 100644 --- a/p11-kit/hashmap.h +++ b/p11-kit/hashmap.h @@ -62,111 +62,112 @@ typedef struct _hashiter { unsigned int index; } hashiter; -typedef unsigned int (*hash_hash_func) (const void *data); +typedef unsigned int (*hash_hash_func) (const void *data); -typedef int (*hash_equal_func) (const void *one, +typedef int (*hash_equal_func) (const void *one, const void *two); -typedef void (*hash_destroy_func) (void *data); +typedef void (*hash_destroy_func) (void *data); /* ----------------------------------------------------------------------------- * MAIN */ /* - * hash_create : Create a hash table + * _p11_hash_create : Create a hash table * - returns an allocated hashtable */ -hashmap* hash_create (hash_hash_func hash_func, +hashmap* _p11_hash_create (hash_hash_func hash_func, hash_equal_func equal_func, hash_destroy_func key_destroy_func, hash_destroy_func value_destroy_func); /* - * hash_free : Free a hash table + * _p11_hash_free : Free a hash table */ -void hash_free (hashmap *map); +void _p11_hash_free (hashmap *map); /* - * hash_size: Number of values in hash table + * _p11_hash_size: Number of values in hash table * - returns the number of entries in hash table */ -unsigned int hash_size (hashmap *map); +unsigned int _p11_hash_size (hashmap *map); /* - * hash_get: Retrieves a value from the hash table + * _p11_hash_get: Retrieves a value from the hash table * - returns the value of the entry */ -void* hash_get (hashmap *map, +void* _p11_hash_get (hashmap *map, const void *key); /* - * hash_set: Set a value in the hash table + * _p11_hash_set: Set a value in the hash table * - returns 1 if the entry was added properly */ -int hash_set (hashmap *map, +int _p11_hash_set (hashmap *map, void *key, void *value); /* - * hash_remove: Remove a value from the hash table + * _p11_hash_remove: Remove a value from the hash table * - returns 1 if the entry was found */ -int hash_remove (hashmap *map, +int _p11_hash_remove (hashmap *map, const void *key); /* - * hash_steal: Remove a value from the hash table without calling destroy funcs + * _p11_hash_steal: Remove a value from the hash table without calling + * destroy funcs * - returns 1 if the entry was found */ -int hash_steal (hashmap *map, +int _p11_hash_steal (hashmap *map, const void *key, void **stolen_key, void **stolen_value); /* - * hash_first: Start enumerating through the hash table + * _p11_hash_iterate: Start enumerating through the hash table * - returns a hash iterator */ -void hash_iterate (hashmap *map, +void _p11_hash_iterate (hashmap *map, hashiter *iter); /* - * hash_next: Enumerate through hash table + * _p11_hash_next: Enumerate through hash table * - sets key and value to key and/or value * - returns whether there was another entry */ -int hash_next (hashiter *iter, +int _p11_hash_next (hashiter *iter, void **key, void **value); /* - * hash_clear: Clear all values from has htable. + * _p11_hash_clear: Clear all values from has htable. */ -void hash_clear (hashmap *map); +void _p11_hash_clear (hashmap *map); /* ----------------------------------------------------------------------------- * HASH FUNCTIONS */ -unsigned int hash_string_hash (const void *string); +unsigned int _p11_hash_string_hash (const void *string); -int hash_string_equal (const void *string_one, +int _p11_hash_string_equal (const void *string_one, const void *string_two); -unsigned int hash_ulongptr_hash (const void *to_ulong); +unsigned int _p11_hash_ulongptr_hash (const void *to_ulong); -int hash_ulongptr_equal (const void *ulong_one, +int _p11_hash_ulongptr_equal (const void *ulong_one, const void *ulong_two); -unsigned int hash_intptr_hash (const void *to_int); +unsigned int _p11_hash_intptr_hash (const void *to_int); -int hash_intptr_equal (const void *int_one, +int _p11_hash_intptr_equal (const void *int_one, const void *int_two); -unsigned int hash_direct_hash (const void *ptr); +unsigned int _p11_hash_direct_hash (const void *ptr); -int hash_direct_equal (const void *ptr_one, +int _p11_hash_direct_equal (const void *ptr_one, const void *ptr_two); #endif /* __HASHMAP_H__ */ diff --git a/p11-kit/modules.c b/p11-kit/modules.c index 34926a4..1c56208 100644 --- a/p11-kit/modules.c +++ b/p11-kit/modules.c @@ -135,7 +135,7 @@ create_mutex (CK_VOID_PTR_PTR mut) pmutex = malloc (sizeof (mutex_t)); if (!pmutex) return CKR_HOST_MEMORY; - mutex_init (pmutex); + _p11_mutex_init (pmutex); *mut = pmutex; return CKR_OK; } @@ -148,7 +148,7 @@ destroy_mutex (CK_VOID_PTR mut) if (mut == NULL) return CKR_MUTEX_BAD; - mutex_uninit (pmutex); + _p11_mutex_uninit (pmutex); free (pmutex); return CKR_OK; } @@ -161,7 +161,7 @@ lock_mutex (CK_VOID_PTR mut) if (mut == NULL) return CKR_MUTEX_BAD; - mutex_lock (pmutex); + _p11_mutex_lock (pmutex); return CKR_OK; } @@ -173,7 +173,7 @@ unlock_mutex (CK_VOID_PTR mut) if (mut == NULL) return CKR_MUTEX_BAD; - mutex_unlock (pmutex); + _p11_mutex_unlock (pmutex); return CKR_OK; } @@ -192,10 +192,10 @@ free_module_unlocked (void *data) assert (mod->ref_count == 0); if (mod->dl_module) - module_close (mod->dl_module); + _p11_module_close (mod->dl_module); - mutex_uninit (&mod->initialize_mutex); - hash_free (mod->config); + _p11_mutex_uninit (&mod->initialize_mutex); + _p11_hash_free (mod->config); free (mod->name); free (mod); } @@ -214,7 +214,7 @@ alloc_module_unlocked (void) mod->init_args.LockMutex = lock_mutex; mod->init_args.UnlockMutex = unlock_mutex; mod->init_args.flags = CKF_OS_LOCKING_OK; - mutex_init (&mod->initialize_mutex); + _p11_mutex_init (&mod->initialize_mutex); return mod; } @@ -262,16 +262,16 @@ dlopen_and_get_function_list (Module *mod, const char *path) assert (mod); assert (path); - mod->dl_module = module_open (path); + mod->dl_module = _p11_module_open (path); if (mod->dl_module == NULL) { - _p11_message ("couldn't load module: %s: %s", path, module_error ()); + _p11_message ("couldn't load module: %s: %s", path, _p11_module_error ()); return CKR_GENERAL_ERROR; } - gfl = module_symbol (mod->dl_module, "C_GetFunctionList"); + gfl = _p11_module_symbol (mod->dl_module, "C_GetFunctionList"); if (!gfl) { _p11_message ("couldn't find C_GetFunctionList entry point in module: %s: %s", - path, module_error ()); + path, _p11_module_error ()); return CKR_GENERAL_ERROR; } @@ -304,14 +304,14 @@ load_module_from_file_unlocked (const char *path, Module **result) } /* Do we have a previous one like this, if so ignore load */ - prev = hash_get (gl.modules, mod->funcs); + prev = _p11_hash_get (gl.modules, mod->funcs); if (prev != NULL) { debug ("duplicate module %s, using previous", path); free_module_unlocked (mod); mod = prev; - } else if (!hash_set (gl.modules, mod->funcs, mod)) { + } else if (!_p11_hash_set (gl.modules, mod->funcs, mod)) { free_module_unlocked (mod); return CKR_HOST_MEMORY; } @@ -349,7 +349,7 @@ take_config_and_load_module_unlocked (char **name, hashmap **config) assert (config); assert (*config); - module_filename = hash_get (*config, "module"); + module_filename = _p11_hash_get (*config, "module"); if (module_filename == NULL) { debug ("no module path for module, skipping: %s", *name); return CKR_OK; @@ -360,7 +360,7 @@ take_config_and_load_module_unlocked (char **name, hashmap **config) return CKR_HOST_MEMORY; /* The hash map will take ownership of the variable */ - if (!hash_set (*config, "module", path)) { + if (!_p11_hash_set (*config, "module", path)) { free (path); return CKR_HOST_MEMORY; } @@ -381,7 +381,7 @@ take_config_and_load_module_unlocked (char **name, hashmap **config) return rv; } - prev = hash_get (gl.modules, mod->funcs); + prev = _p11_hash_get (gl.modules, mod->funcs); /* If same module was loaded previously, just take over config */ if (prev && !prev->name && !prev->config) { @@ -398,7 +398,7 @@ take_config_and_load_module_unlocked (char **name, hashmap **config) /* Add this new module to our hash table */ } else { - if (!hash_set (gl.modules, mod->funcs, mod)) { + if (!_p11_hash_set (gl.modules, mod->funcs, mod)) { free_module_unlocked (mod); return CKR_HOST_MEMORY; } @@ -409,7 +409,7 @@ take_config_and_load_module_unlocked (char **name, hashmap **config) * 'x-init-reserved' setting in the config. This only works with specific * PKCS#11 modules, and is non-standard use of that field. */ - mod->init_args.pReserved = hash_get (mod->config, "x-init-reserved"); + mod->init_args.pReserved = _p11_hash_get (mod->config, "x-init-reserved"); return CKR_OK; } @@ -440,7 +440,7 @@ load_registered_modules_unlocked (void) P11_USER_CONFIG_MODULES); if (configs == NULL) { rv = (errno == ENOMEM) ? CKR_HOST_MEMORY : CKR_GENERAL_ERROR; - hash_free (config); + _p11_hash_free (config); return rv; } @@ -451,13 +451,13 @@ load_registered_modules_unlocked (void) * Now go through each config and turn it into a module. As we iterate * we steal the values of the config. */ - hash_iterate (configs, &iter); - while (hash_next (&iter, &key, NULL)) { - if (!hash_steal (configs, key, (void**)&name, (void**)&config)) + _p11_hash_iterate (configs, &iter); + while (_p11_hash_next (&iter, &key, NULL)) { + if (!_p11_hash_steal (configs, key, (void**)&name, (void**)&config)) assert (0 && "not reached"); /* Is this a critical module, should abort loading of others? */ - critical = _p11_conf_parse_boolean (hash_get (config, "critical"), 0); + critical = _p11_conf_parse_boolean (_p11_hash_get (config, "critical"), 0); rv = take_config_and_load_module_unlocked (&name, &config); @@ -466,16 +466,16 @@ load_registered_modules_unlocked (void) * by the above function call. */ free (name); - hash_free (config); + _p11_hash_free (config); if (critical && rv != CKR_OK) { _p11_message ("aborting initializationg because module '%s' was marked as critical"); - hash_free (configs); + _p11_hash_free (configs); return rv; } } - hash_free (configs); + _p11_hash_free (configs); return CKR_OK; } @@ -486,7 +486,7 @@ initialize_module_unlocked_reentrant (Module *mod) thread_t self; assert (mod); - self = thread_self (); + self = _p11_thread_self (); if (mod->initialize_thread == self) { _p11_message ("p11-kit initialization called recursively"); @@ -501,7 +501,7 @@ initialize_module_unlocked_reentrant (Module *mod) mod->initialize_thread = self; /* Change over to the module specific mutex */ - mutex_lock (&mod->initialize_mutex); + _p11_mutex_lock (&mod->initialize_mutex); _p11_unlock (); if (!mod->initialize_called) { @@ -522,7 +522,7 @@ initialize_module_unlocked_reentrant (Module *mod) rv = CKR_OK; } - mutex_unlock (&mod->initialize_mutex); + _p11_mutex_unlock (&mod->initialize_mutex); _p11_lock (); /* Don't claim reference if failed */ @@ -547,8 +547,8 @@ reinitialize_after_fork (void) _p11_lock (); if (gl.modules) { - hash_iterate (gl.modules, &iter); - while (hash_next (&iter, NULL, (void **)&mod)) { + _p11_hash_iterate (gl.modules, &iter); + while (_p11_hash_next (&iter, NULL, (void **)&mod)) { if (mod->initialize_called) { mod->initialize_called = 0; @@ -571,7 +571,7 @@ init_globals_unlocked (void) static int once = 0; if (!gl.modules) - gl.modules = hash_create (hash_direct_hash, hash_direct_equal, + gl.modules = _p11_hash_create (_p11_hash_direct_hash, _p11_hash_direct_equal, NULL, free_module_unlocked); if (!gl.modules) return CKR_HOST_MEMORY; @@ -594,15 +594,15 @@ free_modules_when_no_refs_unlocked (void) hashiter iter; /* Check if any modules have a ref count */ - hash_iterate (gl.modules, &iter); - while (hash_next (&iter, NULL, (void **)&mod)) { + _p11_hash_iterate (gl.modules, &iter); + while (_p11_hash_next (&iter, NULL, (void **)&mod)) { if (mod->ref_count) return; } - hash_free (gl.modules); + _p11_hash_free (gl.modules); gl.modules = NULL; - hash_free (gl.config); + _p11_hash_free (gl.config); gl.config = NULL; } @@ -628,7 +628,7 @@ finalize_module_unlocked_reentrant (Module *mod) */ ++mod->ref_count; - mutex_lock (&mod->initialize_mutex); + _p11_mutex_lock (&mod->initialize_mutex); _p11_unlock (); if (mod->initialize_called) { @@ -639,7 +639,7 @@ finalize_module_unlocked_reentrant (Module *mod) mod->initialize_called = 0; } - mutex_unlock (&mod->initialize_mutex); + _p11_mutex_unlock (&mod->initialize_mutex); _p11_lock (); /* Match the increment above */ @@ -657,8 +657,8 @@ find_module_for_name_unlocked (const char *name) assert (name); - hash_iterate (gl.modules, &iter); - while (hash_next (&iter, NULL, (void **)&mod)) + _p11_hash_iterate (gl.modules, &iter); + while (_p11_hash_next (&iter, NULL, (void **)&mod)) if (mod->ref_count && mod->name && strcmp (name, mod->name) == 0) return mod; return NULL; @@ -677,8 +677,8 @@ _p11_kit_initialize_registered_unlocked_reentrant (void) rv = load_registered_modules_unlocked (); if (rv == CKR_OK) { - hash_iterate (gl.modules, &iter); - while (hash_next (&iter, NULL, (void **)&mod)) { + _p11_hash_iterate (gl.modules, &iter); + while (_p11_hash_next (&iter, NULL, (void **)&mod)) { /* Skip all modules that aren't registered */ if (!mod->name) @@ -756,13 +756,13 @@ _p11_kit_finalize_registered_unlocked_reentrant (void) /* WARNING: This function must be reentrant */ - to_finalize = calloc (hash_size (gl.modules), sizeof (Module *)); + to_finalize = calloc (_p11_hash_size (gl.modules), sizeof (Module *)); if (!to_finalize) return CKR_HOST_MEMORY; count = 0; - hash_iterate (gl.modules, &iter); - while (hash_next (&iter, NULL, (void **)&mod)) { + _p11_hash_iterate (gl.modules, &iter); + while (_p11_hash_next (&iter, NULL, (void **)&mod)) { /* Skip all modules that aren't registered */ if (mod->name) @@ -835,10 +835,10 @@ _p11_kit_registered_modules_unlocked (void) int i = 0; if (gl.modules) - result = calloc (hash_size (gl.modules) + 1, sizeof (CK_FUNCTION_LIST_PTR)); + result = calloc (_p11_hash_size (gl.modules) + 1, sizeof (CK_FUNCTION_LIST_PTR)); if (result) { - hash_iterate (gl.modules, &iter); - while (hash_next (&iter, NULL, (void **)&mod)) { + _p11_hash_iterate (gl.modules, &iter); + while (_p11_hash_next (&iter, NULL, (void **)&mod)) { if (mod->ref_count && mod->name) result[i++] = mod->funcs; } @@ -902,7 +902,7 @@ p11_kit_registered_module_to_name (CK_FUNCTION_LIST_PTR module) _p11_kit_clear_message (); - mod = module && gl.modules ? hash_get (gl.modules, module) : NULL; + mod = module && gl.modules ? _p11_hash_get (gl.modules, module) : NULL; if (mod && mod->name) name = strdup (mod->name); @@ -972,13 +972,13 @@ p11_kit_registered_option (CK_FUNCTION_LIST_PTR module, const char *field) config = gl.config; } else { - mod = gl.modules ? hash_get (gl.modules, module) : NULL; + mod = gl.modules ? _p11_hash_get (gl.modules, module) : NULL; if (mod) config = mod->config; } if (config && field) { - option = hash_get (config, field); + option = _p11_hash_get (config, field); if (option) option = strdup (option); } @@ -1037,7 +1037,7 @@ p11_kit_initialize_module (CK_FUNCTION_LIST_PTR module) rv = init_globals_unlocked (); if (rv == CKR_OK) { - mod = hash_get (gl.modules, module); + mod = _p11_hash_get (gl.modules, module); if (mod == NULL) { debug ("allocating new module"); allocated = mod = alloc_module_unlocked (); @@ -1049,7 +1049,7 @@ p11_kit_initialize_module (CK_FUNCTION_LIST_PTR module) /* If this was newly allocated, add it to the list */ if (rv == CKR_OK && allocated) { - if (hash_set (gl.modules, allocated->funcs, allocated)) + if (_p11_hash_set (gl.modules, allocated->funcs, allocated)) allocated = NULL; else rv = CKR_HOST_MEMORY; @@ -1119,7 +1119,7 @@ p11_kit_finalize_module (CK_FUNCTION_LIST_PTR module) _p11_kit_clear_message (); - mod = gl.modules ? hash_get (gl.modules, module) : NULL; + mod = gl.modules ? _p11_hash_get (gl.modules, module) : NULL; if (mod == NULL) { debug ("module not found"); rv = CKR_ARGUMENTS_BAD; diff --git a/p11-kit/pin.c b/p11-kit/pin.c index f74620a..531d0d0 100644 --- a/p11-kit/pin.c +++ b/p11-kit/pin.c @@ -220,8 +220,8 @@ p11_kit_pin_register_callback (const char *pin_source, p11_kit_pin_callback call _p11_lock (); if (gl.pin_sources == NULL) { - gl.pin_sources = hash_create (hash_string_hash, hash_string_equal, - free, (hash_destroy_func)ptr_array_free); + gl.pin_sources = _p11_hash_create (_p11_hash_string_hash, _p11_hash_string_equal, + free, (hash_destroy_func)_p11_ptr_array_free); if (gl.pin_sources == NULL) { errno = ENOMEM; ret = -1; @@ -229,15 +229,15 @@ p11_kit_pin_register_callback (const char *pin_source, p11_kit_pin_callback call } if (gl.pin_sources != NULL) - callbacks = hash_get (gl.pin_sources, pin_source); + callbacks = _p11_hash_get (gl.pin_sources, pin_source); if (callbacks == NULL) { - callbacks = ptr_array_create (unref_pin_callback); + callbacks = _p11_ptr_array_create (unref_pin_callback); if (callbacks == NULL) { errno = ENOMEM; ret = -1; - } else if (!hash_set (gl.pin_sources, name, callbacks)) { - ptr_array_free (callbacks); + } else if (!_p11_hash_set (gl.pin_sources, name, callbacks)) { + _p11_ptr_array_free (callbacks); callbacks = NULL; errno = ENOMEM; ret = -1; @@ -248,7 +248,7 @@ p11_kit_pin_register_callback (const char *pin_source, p11_kit_pin_callback call } if (callbacks != NULL) { - if (ptr_array_add (callbacks, cb) < 0) { + if (_p11_ptr_array_add (callbacks, cb) < 0) { errno = ENOMEM; ret = -1; } else { @@ -289,23 +289,23 @@ p11_kit_pin_unregister_callback (const char *pin_source, p11_kit_pin_callback ca _p11_lock (); if (gl.pin_sources) { - callbacks = hash_get (gl.pin_sources, pin_source); + callbacks = _p11_hash_get (gl.pin_sources, pin_source); if (callbacks) { - for (i = 0; i < ptr_array_count (callbacks); i++) { - cb = ptr_array_at (callbacks, i); + for (i = 0; i < _p11_ptr_array_count (callbacks); i++) { + cb = _p11_ptr_array_at (callbacks, i); if (cb->func == callback && cb->user_data == callback_data) { - ptr_array_remove (callbacks, i); + _p11_ptr_array_remove (callbacks, i); break; } } - if (ptr_array_count (callbacks) == 0) - hash_remove (gl.pin_sources, pin_source); + if (_p11_ptr_array_count (callbacks) == 0) + _p11_hash_remove (gl.pin_sources, pin_source); } /* When there are no more pin sources, get rid of the hash table */ - if (hash_size (gl.pin_sources) == 0) { - hash_free (gl.pin_sources); + if (_p11_hash_size (gl.pin_sources) == 0) { + _p11_hash_free (gl.pin_sources); gl.pin_sources = NULL; } } @@ -358,15 +358,15 @@ p11_kit_pin_request (const char *pin_source, P11KitUri *pin_uri, /* Find and ref the pin source data */ if (gl.pin_sources) { - callbacks = hash_get (gl.pin_sources, pin_source); + callbacks = _p11_hash_get (gl.pin_sources, pin_source); /* If we didn't find any snapshots try the global ones */ if (callbacks == NULL) - callbacks = hash_get (gl.pin_sources, P11_KIT_PIN_FALLBACK); + callbacks = _p11_hash_get (gl.pin_sources, P11_KIT_PIN_FALLBACK); if (callbacks != NULL) { - snapshot = (PinCallback**)ptr_array_snapshot (callbacks); - snapshot_count = ptr_array_count (callbacks); + snapshot = (PinCallback**)_p11_ptr_array_snapshot (callbacks); + snapshot_count = _p11_ptr_array_count (callbacks); for (i = 0; i < snapshot_count; i++) ref_pin_callback (snapshot[i]); } @@ -471,7 +471,7 @@ p11_kit_pin_file_callback (const char *pin_source, for (;;) { if (used + 256 > allocated) { - buffer = xrealloc (buffer, used + 1024); + buffer = _p11_realloc (buffer, used + 1024); if (buffer == NULL) { error = ENOMEM; break; diff --git a/p11-kit/private.h b/p11-kit/private.h index a8f46c5..d23c1e6 100644 --- a/p11-kit/private.h +++ b/p11-kit/private.h @@ -49,9 +49,9 @@ typedef struct { #endif } p11_local; -#define _p11_lock() mutex_lock (&_p11_mutex); +#define _p11_lock() _p11_mutex_lock (&_p11_mutex); -#define _p11_unlock() mutex_unlock (&_p11_mutex); +#define _p11_unlock() _p11_mutex_unlock (&_p11_mutex); void _p11_message (const char* msg, ...); diff --git a/p11-kit/proxy.c b/p11-kit/proxy.c index ebb1309..d6e5006 100644 --- a/p11-kit/proxy.c +++ b/p11-kit/proxy.c @@ -147,7 +147,7 @@ map_session_to_real (CK_SESSION_HANDLE_PTR handle, Mapping *mapping, Session *se rv = CKR_CRYPTOKI_NOT_INITIALIZED; } else { assert (gl.sessions); - sess = hash_get (gl.sessions, handle); + sess = _p11_hash_get (gl.sessions, handle); if (sess != NULL) { *handle = sess->real_session; rv = map_slot_unlocked (sess->wrap_slot, mapping); @@ -177,7 +177,7 @@ finalize_mappings_unlocked (void) gl.n_mappings = 0; /* no more sessions */ - hash_free (gl.sessions); + _p11_hash_free (gl.sessions); gl.sessions = NULL; } @@ -270,7 +270,7 @@ initialize_mappings_unlocked_reentrant (void) break; } - mappings = xrealloc (mappings, sizeof (Mapping) * (n_mappings + count)); + mappings = _p11_realloc (mappings, sizeof (Mapping) * (n_mappings + count)); if (!mappings) { free (slots); rv = CKR_HOST_MEMORY; @@ -297,7 +297,7 @@ initialize_mappings_unlocked_reentrant (void) assert (!gl.sessions); gl.mappings = mappings; gl.n_mappings = n_mappings; - gl.sessions = hash_create (hash_ulongptr_hash, hash_ulongptr_equal, NULL, free); + gl.sessions = _p11_hash_create (_p11_hash_ulongptr_hash, _p11_hash_ulongptr_equal, NULL, free); ++gl.mappings_refs; /* Any cleanup necessary for failure will happen at caller */ @@ -525,7 +525,7 @@ proxy_C_OpenSession (CK_SLOT_ID id, CK_FLAGS flags, CK_VOID_PTR user_data, sess->wrap_slot = map.wrap_slot; sess->real_session = *handle; sess->wrap_session = ++gl.last_handle; /* TODO: Handle wrapping, and then collisions */ - hash_set (gl.sessions, &sess->wrap_session, sess); + _p11_hash_set (gl.sessions, &sess->wrap_session, sess); *handle = sess->wrap_session; } @@ -552,7 +552,7 @@ proxy_C_CloseSession (CK_SESSION_HANDLE handle) _p11_lock (); if (gl.sessions) - hash_remove (gl.sessions, &key); + _p11_hash_remove (gl.sessions, &key); _p11_unlock (); } @@ -574,13 +574,13 @@ proxy_C_CloseAllSessions (CK_SLOT_ID id) if (!gl.sessions) { rv = CKR_CRYPTOKI_NOT_INITIALIZED; } else { - to_close = calloc (sizeof (CK_SESSION_HANDLE), hash_size (gl.sessions)); + to_close = calloc (sizeof (CK_SESSION_HANDLE), _p11_hash_size (gl.sessions)); if (!to_close) { rv = CKR_HOST_MEMORY; } else { - hash_iterate (gl.sessions, &iter); + _p11_hash_iterate (gl.sessions, &iter); count = 0; - while (hash_next (&iter, NULL, (void**)&sess)) { + while (_p11_hash_next (&iter, NULL, (void**)&sess)) { if (sess->wrap_slot == id && to_close) to_close[count++] = sess->wrap_session; } diff --git a/p11-kit/ptr-array.c b/p11-kit/ptr-array.c index 6a5ac4f..f393641 100644 --- a/p11-kit/ptr-array.c +++ b/p11-kit/ptr-array.c @@ -45,7 +45,8 @@ struct ptr_array { }; static int -maybe_expand_array (ptr_array_t *array, unsigned int length) +maybe_expand_array (ptr_array_t *array, + unsigned int length) { unsigned int new_allocated; void **new_memory; @@ -66,8 +67,8 @@ maybe_expand_array (ptr_array_t *array, unsigned int length) return 1; } -ptr_array_t* -ptr_array_create (ptr_array_destroy_func destroy_func) +ptr_array_t * +_p11_ptr_array_create (ptr_array_destroy_func destroy_func) { ptr_array_t *array; @@ -76,7 +77,7 @@ ptr_array_create (ptr_array_destroy_func destroy_func) return NULL; if (!maybe_expand_array (array, 2)) { - ptr_array_free (array); + _p11_ptr_array_free (array); return NULL; } @@ -85,7 +86,7 @@ ptr_array_create (ptr_array_destroy_func destroy_func) } void -ptr_array_free (ptr_array_t *array) +_p11_ptr_array_free (ptr_array_t *array) { unsigned int i; @@ -102,13 +103,14 @@ ptr_array_free (ptr_array_t *array) } unsigned int -ptr_array_count (ptr_array_t *array) +_p11_ptr_array_count (ptr_array_t *array) { return array->length; } int -ptr_array_add (ptr_array_t *array, void *value) +_p11_ptr_array_add (ptr_array_t *array, + void *value) { if (!maybe_expand_array (array, array->length + 1)) return 0; @@ -119,7 +121,8 @@ ptr_array_add (ptr_array_t *array, void *value) } void -ptr_array_remove (ptr_array_t *array, unsigned int index) +_p11_ptr_array_remove (ptr_array_t *array, + unsigned int index) { if (array->destroy) (array->destroy) (array->memory[index]); @@ -128,14 +131,15 @@ ptr_array_remove (ptr_array_t *array, unsigned int index) array->length--; } -void* -ptr_array_at (ptr_array_t *array, unsigned int index) +void * +_p11_ptr_array_at (ptr_array_t *array, + unsigned int index) { return array->memory[index]; } -void** -ptr_array_snapshot (ptr_array_t *array) +void ** +_p11_ptr_array_snapshot (ptr_array_t *array) { void **snapshot; size_t bytes; diff --git a/p11-kit/ptr-array.h b/p11-kit/ptr-array.h index acd894d..ba7ec87 100644 --- a/p11-kit/ptr-array.h +++ b/p11-kit/ptr-array.h @@ -41,21 +41,21 @@ typedef struct ptr_array ptr_array_t; typedef void (*ptr_array_destroy_func) (void *data); -ptr_array_t* ptr_array_create (ptr_array_destroy_func destroy_func); +ptr_array_t* _p11_ptr_array_create (ptr_array_destroy_func destroy_func); -void ptr_array_free (ptr_array_t *array); +void _p11_ptr_array_free (ptr_array_t *array); -unsigned int ptr_array_count (ptr_array_t *array); +unsigned int _p11_ptr_array_count (ptr_array_t *array); -int ptr_array_add (ptr_array_t *array, +int _p11_ptr_array_add (ptr_array_t *array, void *value); -void ptr_array_remove (ptr_array_t *array, +void _p11_ptr_array_remove (ptr_array_t *array, unsigned int index); -void* ptr_array_at (ptr_array_t *array, +void* _p11_ptr_array_at (ptr_array_t *array, unsigned int index); -void** ptr_array_snapshot (ptr_array_t *array); +void** _p11_ptr_array_snapshot (ptr_array_t *array); #endif /* __PTR_ARRAY_H__ */ diff --git a/p11-kit/uri.c b/p11-kit/uri.c index bd057d5..e9989c8 100644 --- a/p11-kit/uri.c +++ b/p11-kit/uri.c @@ -806,7 +806,7 @@ format_raw_string (char **string, size_t *length, int *is_first, namelen = strlen (name); vallen = strlen (value); - *string = xrealloc (*string, *length + namelen + vallen + 3); + *string = _p11_realloc (*string, *length + namelen + vallen + 3); if (!*string) return 0; diff --git a/p11-kit/util.c b/p11-kit/util.c index eab0b13..933365d 100644 --- a/p11-kit/util.c +++ b/p11-kit/util.c @@ -72,7 +72,7 @@ pthread_once_t _p11_once; static int print_messages = 1; void* -xrealloc (void *memory, size_t length) +_p11_realloc (void *memory, size_t length) { void *allocated = realloc (memory, length); if (!allocated) @@ -268,8 +268,8 @@ _p11_library_get_thread_local (void) void _p11_library_init (void) { - debug_init (); - mutex_init (&_p11_mutex); + _p11_debug_init (); + _p11_mutex_init (&_p11_mutex); pthread_key_create (&thread_local, free); } @@ -277,7 +277,7 @@ void _p11_library_uninit (void) { pthread_key_delete (thread_local); - mutex_uninit (&_p11_mutex); + _p11_mutex_uninit (&_p11_mutex); } #endif /* OS_UNIX */ @@ -309,7 +309,7 @@ void _p11_library_init (void) { debug_init (); - mutex_init (&_p11_mutex); + _p11_mutex_init (&_p11_mutex); thread_local = TlsAlloc (); } @@ -332,7 +332,7 @@ _p11_library_uninit (void) free_tls_value (data); TlsFree (thread_local); } - mutex_uninit (&_p11_mutex); + _p11_mutex_uninit (&_p11_mutex); } BOOL WINAPI diff --git a/p11-kit/util.h b/p11-kit/util.h index 2e005c7..36c8c24 100644 --- a/p11-kit/util.h +++ b/p11-kit/util.h @@ -39,6 +39,6 @@ #include <sys/types.h> -void* xrealloc (void *memory, size_t length); +void* _p11_realloc (void *memory, size_t length); #endif /* __UTIL_H__ */ |