From 92e2833403321fe630b22ccdeb00a31fec7785aa Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 18 Oct 2019 20:07:52 +0200 Subject: Fix building as C++ --- zix/ampatree.c | 6 +++--- zix/patree.c | 4 ++-- zix/strindex.c | 2 +- zix/trie.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zix/ampatree.c b/zix/ampatree.c index f0a45a3..58d1332 100644 --- a/zix/ampatree.c +++ b/zix/ampatree.c @@ -108,7 +108,7 @@ zix_ampatree_new(void) { ZixAMPatree* t = (ZixAMPatree*)calloc(1, sizeof(ZixAMPatree)); - t->root = calloc(1, sizeof(ZixAMPatreeNode)); + t->root = (ZixAMPatreeNode*)calloc(1, sizeof(ZixAMPatreeNode)); return t; } @@ -171,8 +171,8 @@ patree_add_edge(ZixAMPatreeNode** n_ptr, child->str = str; child->n_children = 0; - n = realloc_node(n, n->n_children + 1); - ZixAMPatreeNode* m = malloc(zix_ampatree_node_size(n->n_children + 1)); + n = (ZixAMPatreeNode*)realloc_node(n, n->n_children + 1); + ZixAMPatreeNode* m = (ZixAMPatreeNode*)malloc(zix_ampatree_node_size(n->n_children + 1)); m->label_first = n->label_first; m->label_last = n->label_last; m->str = n->str; diff --git a/zix/patree.c b/zix/patree.c index fe552d8..f984005 100644 --- a/zix/patree.c +++ b/zix/patree.c @@ -122,7 +122,7 @@ zix_patree_new(void) { ZixPatree* t = (ZixPatree*)calloc(1, sizeof(ZixPatree)); - t->root = calloc(1, sizeof(ZixPatreeNode)); + t->root = (ZixPatreeNode*)calloc(1, sizeof(ZixPatreeNode)); return t; } @@ -196,7 +196,7 @@ patree_add_edge(ZixPatreeNode** n_ptr, *zix_patree_get_child_ptr(n, n->n_children - 1) = child; #else const n_edges_t l = zix_trie_find_key(n->children, n->n_children, first[0]); - ZixPatreeNode* m = malloc(zix_patree_node_size(n->n_children + 1)); + ZixPatreeNode* m = (ZixPatreeNode*)malloc(zix_patree_node_size(n->n_children + 1)); m->label_first = n->label_first; m->label_last = n->label_last; m->str = n->str; diff --git a/zix/strindex.c b/zix/strindex.c index 6323944..fffc94f 100644 --- a/zix/strindex.c +++ b/zix/strindex.c @@ -53,7 +53,7 @@ zix_strindex_new(const char* s) ZixStrindex* t = (ZixStrindex*)malloc(sizeof(ZixStrindex)); memset(t, '\0', sizeof(struct _ZixStrindex)); - t->s = calloc(1, len + 1); + t->s = (char*)calloc(1, len + 1); memcpy(t->s, s, len); t->root = (ZixStrindexNode*)malloc(sizeof(ZixStrindexNode)); diff --git a/zix/trie.c b/zix/trie.c index e942cff..8a7661c 100644 --- a/zix/trie.c +++ b/zix/trie.c @@ -111,7 +111,7 @@ zix_trie_new(void) { ZixTrie* t = (ZixTrie*)calloc(1, sizeof(ZixTrie)); - t->root = calloc(1, sizeof(ZixTrieNode)); + t->root = (ZixTrieNode*)calloc(1, sizeof(ZixTrieNode)); return t; } @@ -177,7 +177,7 @@ zix_trie_add_child(ZixTrieNode** n_ptr, *zix_trie_get_child_ptr(n, n->num_children - 1) = child; #else const n_edges_t l = zix_trie_find_key(n->children, n->num_children, first); - ZixTrieNode* m = malloc(zix_trie_node_size(n->num_children + 1)); + ZixTrieNode* m = (ZixTrieNode*)malloc(zix_trie_node_size(n->num_children + 1)); m->str = n->str; m->num_children = n->num_children + 1; -- cgit v1.2.1