summaryrefslogtreecommitdiffstats
path: root/src/zix
diff options
context:
space:
mode:
Diffstat (limited to 'src/zix')
-rw-r--r--src/zix/common.h15
-rw-r--r--src/zix/hash.c2
-rw-r--r--src/zix/tree.c4
-rw-r--r--src/zix/tree.h2
4 files changed, 15 insertions, 8 deletions
diff --git a/src/zix/common.h b/src/zix/common.h
index 2f63fca..e7d35e1 100644
--- a/src/zix/common.h
+++ b/src/zix/common.h
@@ -17,8 +17,6 @@
#ifndef ZIX_COMMON_H
#define ZIX_COMMON_H
-#include <stdbool.h>
-
/**
@addtogroup zix
@{
@@ -43,6 +41,12 @@
#endif
/** @endcond */
+#ifdef __cplusplus
+extern "C" {
+#else
+# include <stdbool.h>
+#endif
+
typedef enum {
ZIX_STATUS_SUCCESS,
ZIX_STATUS_ERROR,
@@ -61,7 +65,12 @@ typedef int (*ZixComparator)(const void* a, const void* b, void* user_data);
*/
typedef bool (*ZixEqualFunc)(const void* a, const void* b);
-/**@}
+/**
+ @}
*/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
#endif /* ZIX_COMMON_H */
diff --git a/src/zix/hash.c b/src/zix/hash.c
index c267757..f654e91 100644
--- a/src/zix/hash.c
+++ b/src/zix/hash.c
@@ -55,7 +55,7 @@ zix_hash_new(ZixHashFunc hash_func,
hash->key_equal_func = key_equal_func;
hash->count = 0;
hash->n_buckets = &sizes[0];
- hash->buckets = malloc(*hash->n_buckets * sizeof(Entry*));
+ hash->buckets = (Entry**)malloc(*hash->n_buckets * sizeof(Entry*));
memset(hash->buckets, 0, *hash->n_buckets * sizeof(Entry*));
return hash;
diff --git a/src/zix/tree.c b/src/zix/tree.c
index 066b038..64e6e7c 100644
--- a/src/zix/tree.c
+++ b/src/zix/tree.c
@@ -47,7 +47,7 @@ ZIX_API
ZixTree*
zix_tree_new(bool allow_duplicates, ZixComparator cmp, void* cmp_data)
{
- ZixTree* t = malloc(sizeof(ZixTree));
+ ZixTree* t = (ZixTree*)malloc(sizeof(ZixTree));
t->root = NULL;
t->cmp = cmp;
t->cmp_data = cmp_data;
@@ -287,7 +287,7 @@ zix_tree_insert(ZixTree* t, void* e, ZixTreeIter** ti)
}
// Allocate a new node n
- if (!(n = malloc(sizeof(ZixTreeNode)))) {
+ if (!(n = (ZixTreeNode*)malloc(sizeof(ZixTreeNode)))) {
return ZIX_STATUS_NO_MEM;
}
memset(n, '\0', sizeof(ZixTreeNode));
diff --git a/src/zix/tree.h b/src/zix/tree.h
index 670c437..bcbde26 100644
--- a/src/zix/tree.h
+++ b/src/zix/tree.h
@@ -17,8 +17,6 @@
#ifndef ZIX_TREE_H
#define ZIX_TREE_H
-#include <stdbool.h>
-
#include "zix/common.h"
#ifdef __cplusplus