From b28c936bd281c4b7ff9ed0f621b840f6d5a4b328 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 23 Jan 2013 14:29:25 +0100 Subject: 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.. --- p11-kit/tests/mock-module.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'p11-kit/tests/mock-module.c') 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; } } -- cgit v1.1