summaryrefslogtreecommitdiff
path: root/p11-kit/tests/mock-module.c
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-01-23 14:29:25 +0100
committerStef Walter <stefw@gnome.org>2013-01-23 14:29:25 +0100
commitb28c936bd281c4b7ff9ed0f621b840f6d5a4b328 (patch)
tree9645b90b794908d378970aafd73e7726c5267341 /p11-kit/tests/mock-module.c
parent4671352fe2a4f56c6707322dcab0015e2e8600c4 (diff)
Use the stdbool.h C99 bool type
It was getting really wild knowing whether a function returning an int would return -1 on failure or 0 or whether the int return value was actually a number etc..
Diffstat (limited to 'p11-kit/tests/mock-module.c')
-rw-r--r--p11-kit/tests/mock-module.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/p11-kit/tests/mock-module.c b/p11-kit/tests/mock-module.c
index 1a74806..15db600 100644
--- a/p11-kit/tests/mock-module.c
+++ b/p11-kit/tests/mock-module.c
@@ -53,7 +53,7 @@
static p11_mutex_t init_mutex;
/* Whether we've been initialized, and on what process id it happened */
-static int pkcs11_initialized = 0;
+static bool pkcs11_initialized = false;
static pid_t pkcs11_initialized_pid = 0;
/* -----------------------------------------------------------------------------
@@ -141,10 +141,10 @@ mock_C_Initialize (CK_VOID_PTR init_args)
done:
/* Mark us as officially initialized */
if (ret == CKR_OK) {
- pkcs11_initialized = 1;
+ pkcs11_initialized = true;
pkcs11_initialized_pid = pid;
} else if (ret != CKR_CRYPTOKI_ALREADY_INITIALIZED) {
- pkcs11_initialized = 0;
+ pkcs11_initialized = false;
pkcs11_initialized_pid = 0;
}
@@ -158,13 +158,13 @@ CK_RV
mock_C_Finalize (CK_VOID_PTR reserved)
{
debug (("C_Finalize: enter"));
- return_val_if_fail (pkcs11_initialized != 0, CKR_CRYPTOKI_NOT_INITIALIZED);
+ return_val_if_fail (pkcs11_initialized, CKR_CRYPTOKI_NOT_INITIALIZED);
return_val_if_fail (reserved == NULL, CKR_ARGUMENTS_BAD);
p11_mutex_lock (&init_mutex);
/* This should stop all other calls in */
- pkcs11_initialized = 0;
+ pkcs11_initialized = false;
pkcs11_initialized_pid = 0;
p11_mutex_unlock (&init_mutex);
@@ -890,9 +890,9 @@ CK_FUNCTION_LIST mock_module_no_slots = {
void
mock_module_init (void)
{
- static int initialized = 0;
+ static bool initialized = false;
if (!initialized) {
p11_mutex_init (&init_mutex);
- initialized = 1;
+ initialized = true;
}
}