summaryrefslogtreecommitdiff
path: root/common/dict.h
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 /common/dict.h
parent4671352fe2a4f56c6707322dcab0015e2e8600c4 (diff)
downloadp11-kit-b28c936bd281c4b7ff9ed0f621b840f6d5a4b328.tar.gz
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 'common/dict.h')
-rw-r--r--common/dict.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/common/dict.h b/common/dict.h
index 1ba7185..e13c5d6 100644
--- a/common/dict.h
+++ b/common/dict.h
@@ -36,7 +36,7 @@
#ifndef P11_DICT_H_
#define P11_DICT_H_
-#include <sys/types.h>
+#include "compat.h"
/*
* ARGUMENT DOCUMENTATION
@@ -64,7 +64,7 @@ typedef struct _p11_dictiter {
typedef unsigned int (*p11_dict_hasher) (const void *data);
-typedef int (*p11_dict_equals) (const void *one,
+typedef bool (*p11_dict_equals) (const void *one,
const void *two);
#ifndef P11_DESTROYER_DEFINED
@@ -107,25 +107,25 @@ void* p11_dict_get (p11_dict *dict,
/*
* p11_dict_set: Set a value in the hash table
- * - returns 1 if the entry was added properly
+ * - returns true if the entry was added properly
*/
-int p11_dict_set (p11_dict *dict,
+bool p11_dict_set (p11_dict *dict,
void *key,
void *value);
/*
* p11_dict_remove: Remove a value from the hash table
- * - returns 1 if the entry was found
+ * - returns true if the entry was found
*/
-int p11_dict_remove (p11_dict *dict,
+bool p11_dict_remove (p11_dict *dict,
const void *key);
/*
* p11_dict_steal: Remove a value from the hash table without calling
* destroy funcs
- * - returns 1 if the entry was found
+ * - returns true if the entry was found
*/
-int p11_dict_steal (p11_dict *dict,
+bool p11_dict_steal (p11_dict *dict,
const void *key,
void **stolen_key,
void **stolen_value);
@@ -142,7 +142,7 @@ void p11_dict_iterate (p11_dict *dict,
* - sets key and value to key and/or value
* - returns whether there was another entry
*/
-int p11_dict_next (p11_dictiter *iter,
+bool p11_dict_next (p11_dictiter *iter,
void **key,
void **value);
@@ -157,22 +157,22 @@ void p11_dict_clear (p11_dict *dict);
unsigned int p11_dict_str_hash (const void *string);
-int p11_dict_str_equal (const void *string_one,
+bool p11_dict_str_equal (const void *string_one,
const void *string_two);
unsigned int p11_dict_ulongptr_hash (const void *to_ulong);
-int p11_dict_ulongptr_equal (const void *ulong_one,
+bool p11_dict_ulongptr_equal (const void *ulong_one,
const void *ulong_two);
unsigned int p11_dict_intptr_hash (const void *to_int);
-int p11_dict_intptr_equal (const void *int_one,
+bool p11_dict_intptr_equal (const void *int_one,
const void *int_two);
unsigned int p11_dict_direct_hash (const void *ptr);
-int p11_dict_direct_equal (const void *ptr_one,
+bool p11_dict_direct_equal (const void *ptr_one,
const void *ptr_two);
#endif /* __P11_DICT_H__ */