summaryrefslogtreecommitdiffstats
path: root/src/zix
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-01-17 02:13:19 +0000
committerDavid Robillard <d@drobilla.net>2012-01-17 02:13:19 +0000
commit33b20e5c20b0bbac5db9d8022ee5499b8cb95b5c (patch)
tree8017b89fe372677d21d73782ab0b2a6a4cdb99b6 /src/zix
parent012e8a8785abcbf403d842d67303d7470b33694c (diff)
downloadlilv-33b20e5c20b0bbac5db9d8022ee5499b8cb95b5c.tar.gz
lilv-33b20e5c20b0bbac5db9d8022ee5499b8cb95b5c.tar.bz2
lilv-33b20e5c20b0bbac5db9d8022ee5499b8cb95b5c.zip
Support compilation as C++ under MSVC++,
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3955 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/zix')
-rw-r--r--src/zix/common.h15
-rw-r--r--src/zix/tree.c5
-rw-r--r--src/zix/tree.h1
3 files changed, 14 insertions, 7 deletions
diff --git a/src/zix/common.h b/src/zix/common.h
index 59a9511..ab7e431 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,
@@ -66,7 +70,12 @@ typedef bool (*ZixEqualFunc)(const void* a, const void* b);
*/
typedef void (*ZixDestroyFunc)(void* ptr);
-/**@}
+/**
+ @}
*/
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
#endif /* ZIX_COMMON_H */
diff --git a/src/zix/tree.c b/src/zix/tree.c
index d22f438..39f3b36 100644
--- a/src/zix/tree.c
+++ b/src/zix/tree.c
@@ -15,7 +15,6 @@
*/
#include <assert.h>
-#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -74,7 +73,7 @@ zix_tree_new(bool allow_duplicates,
void* cmp_data,
ZixDestroyFunc destroy)
{
- ZixTree* t = malloc(sizeof(ZixTree));
+ ZixTree* t = (ZixTree*)malloc(sizeof(ZixTree));
t->root = NULL;
t->destroy = destroy;
t->cmp = cmp;
@@ -368,7 +367,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 378db28..5a74fd7 100644
--- a/src/zix/tree.h
+++ b/src/zix/tree.h
@@ -17,7 +17,6 @@
#ifndef ZIX_TREE_H
#define ZIX_TREE_H
-#include <stdbool.h>
#include <stddef.h>
#include "zix/common.h"