From 9bb1613011370b00c7b561d7de30c205a246a586 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 25 Jan 2017 11:23:57 +0100 Subject: virtual: Make virtual-fixed internal API cleaner Add proper inclusion guard to virtual-fixed.h and move the declarations of the (un)initialization functions there. --- p11-kit/util.c | 10 +++++----- p11-kit/virtual-fixed.h | 9 +++++++++ p11-kit/virtual.c | 4 ++-- p11-kit/virtual.h | 4 ---- 4 files changed, 16 insertions(+), 11 deletions(-) (limited to 'p11-kit') diff --git a/p11-kit/util.c b/p11-kit/util.c index 816952f..e51223e 100644 --- a/p11-kit/util.c +++ b/p11-kit/util.c @@ -45,7 +45,7 @@ #include "p11-kit.h" #include "private.h" #include "proxy.h" -#include "virtual.h" +#include "virtual-fixed.h" #include #include @@ -252,7 +252,7 @@ void _p11_kit_init (void) { p11_library_init_once (); - p11_virtual_init_fixed (); + p11_virtual_fixed_init (); } #ifdef __GNUC__ @@ -262,7 +262,7 @@ void _p11_kit_fini (void) { p11_proxy_module_cleanup (); - p11_virtual_uninit_fixed (); + p11_virtual_fixed_uninit (); p11_library_uninit (); } @@ -280,14 +280,14 @@ DllMain (HINSTANCE instance, switch (reason) { case DLL_PROCESS_ATTACH: p11_library_init (); - p11_virtual_init_fixed (); + p11_virtual_fixed_init (); break; case DLL_THREAD_DETACH: p11_library_thread_cleanup (); break; case DLL_PROCESS_DETACH: p11_proxy_module_cleanup (); - p11_virtual_uninit_fixed (); + p11_virtual_fixed_uninit (); p11_library_uninit (); break; default: diff --git a/p11-kit/virtual-fixed.h b/p11-kit/virtual-fixed.h index 1cb685d..cc3b2c0 100644 --- a/p11-kit/virtual-fixed.h +++ b/p11-kit/virtual-fixed.h @@ -32,6 +32,10 @@ * Author: Daiki Ueno */ +#ifndef __P11_VIRTUAL_FIXED_H__ +#define __P11_VIRTUAL_FIXED_H__ + +/* The maximum number of precompiled closures. */ #define P11_VIRTUAL_MAX_FIXED 64 #define P11_VIRTUAL_FIXED_FUNCTIONS(fixed_index) \ @@ -1133,3 +1137,8 @@ fixed ## fixed_index ## _C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list) \ short_C_CancelFunction, \ fixed ## fixed_index ## _C_WaitForSlotEvent \ } + +void p11_virtual_fixed_init (void); +void p11_virtual_fixed_uninit (void); + +#endif /* __P11_VIRTUAL_FIXED_H__ */ diff --git a/p11-kit/virtual.c b/p11-kit/virtual.c index a9eae56..b066b4b 100644 --- a/p11-kit/virtual.c +++ b/p11-kit/virtual.c @@ -102,7 +102,7 @@ static void (CK_FUNCTION_LIST_PTR module); void -p11_virtual_init_fixed (void) +p11_virtual_fixed_init (void) { p11_lock (); p11_mutex_init (&fixed_mutex); @@ -111,7 +111,7 @@ p11_virtual_init_fixed (void) } void -p11_virtual_uninit_fixed (void) +p11_virtual_fixed_uninit (void) { p11_lock (); p11_mutex_uninit (&fixed_mutex); diff --git a/p11-kit/virtual.h b/p11-kit/virtual.h index 8083eb9..3124cc9 100644 --- a/p11-kit/virtual.h +++ b/p11-kit/virtual.h @@ -63,8 +63,4 @@ bool p11_virtual_is_wrapper (CK_FUNCTION_LIST *module); void p11_virtual_unwrap (CK_FUNCTION_LIST *module); -void p11_virtual_init_fixed (void); -void p11_virtual_uninit_fixed - (void); - #endif /* __P11_VIRTUAL_H__ */ -- cgit v1.1