Skip to content

Commit

Permalink
virtual: Make virtual-fixed internal API cleaner
Browse files Browse the repository at this point in the history
Add proper inclusion guard to virtual-fixed.h and move the declarations
of the (un)initialization functions there.
  • Loading branch information
ueno committed Jan 25, 2017
1 parent 08ecac9 commit 9bb1613
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
10 changes: 5 additions & 5 deletions p11-kit/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "p11-kit.h"
#include "private.h"
#include "proxy.h"
#include "virtual.h"
#include "virtual-fixed.h"

#include <assert.h>
#include <stdarg.h>
Expand Down Expand Up @@ -252,7 +252,7 @@ void
_p11_kit_init (void)
{
p11_library_init_once ();
p11_virtual_init_fixed ();
p11_virtual_fixed_init ();
}

#ifdef __GNUC__
Expand All @@ -262,7 +262,7 @@ void
_p11_kit_fini (void)
{
p11_proxy_module_cleanup ();
p11_virtual_uninit_fixed ();
p11_virtual_fixed_uninit ();
p11_library_uninit ();
}

Expand All @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions p11-kit/virtual-fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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__ */
4 changes: 2 additions & 2 deletions p11-kit/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions p11-kit/virtual.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */

0 comments on commit 9bb1613

Please sign in to comment.