diff options
author | David Robillard <d@drobilla.net> | 2012-01-16 22:23:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-01-16 22:23:42 +0000 |
commit | bcdb9db57e8f68ba90077a77a4152b72ca6da7ac (patch) | |
tree | 72e39dbd9f503827bbb74d311c22456eef918736 /src/zix | |
parent | ec82c58f79e7555b4dfe9b832099aa8ee240b8ec (diff) | |
download | sord-bcdb9db57e8f68ba90077a77a4152b72ca6da7ac.tar.gz sord-bcdb9db57e8f68ba90077a77a4152b72ca6da7ac.tar.bz2 sord-bcdb9db57e8f68ba90077a77a4152b72ca6da7ac.zip |
Support compilation as C++ under MSVC++.
git-svn-id: http://svn.drobilla.net/sord/trunk@194 3d64ff67-21c5-427c-a301-fe4f08042e5a
Diffstat (limited to 'src/zix')
-rw-r--r-- | src/zix/common.h | 15 | ||||
-rw-r--r-- | src/zix/hash.c | 2 | ||||
-rw-r--r-- | src/zix/tree.c | 4 | ||||
-rw-r--r-- | src/zix/tree.h | 2 |
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 |