From 94067178850802ff87ec4de1662c56c80e50397f Mon Sep 17 00:00:00 2001 From: john spurling Date: Sun, 4 Feb 2018 16:16:39 -0800 Subject: [PATCH] add missing "extern C" qualifiers to a few headers for C++ linking; (#150) fix a few typos/style deviations --- include/cc_mm.h | 8 ++++++++ include/cc_rbuf.h | 8 ++++++++ include/cc_ring_array.h | 9 +++++++++ include/hash/cc_murmur3.h | 18 +++++++++++++----- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/include/cc_mm.h b/include/cc_mm.h index 9705bd840..2d982196e 100644 --- a/include/cc_mm.h +++ b/include/cc_mm.h @@ -17,6 +17,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -70,3 +74,7 @@ void * _cc_realloc_move(void *ptr, size_t size, const char *name, int line); void _cc_free(void *ptr, const char *name, int line); void * _cc_mmap(size_t size, const char *name, int line); int _cc_munmap(void *p, size_t size, const char *name, int line); + +#ifdef __cplusplus +} +#endif diff --git a/include/cc_rbuf.h b/include/cc_rbuf.h index 741ce8edb..7db08335b 100644 --- a/include/cc_rbuf.h +++ b/include/cc_rbuf.h @@ -21,6 +21,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -86,3 +90,7 @@ size_t rbuf_wcap(struct rbuf *buf); size_t rbuf_read(void *dst, struct rbuf *src, size_t n); /* write from a buffer in memory to the rbuf */ size_t rbuf_write(struct rbuf *dst, void *src, size_t n); + +#ifdef __cplusplus +} +#endif diff --git a/include/cc_ring_array.h b/include/cc_ring_array.h index e9efbb745..e970ba6bc 100644 --- a/include/cc_ring_array.h +++ b/include/cc_ring_array.h @@ -26,6 +26,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -53,4 +57,9 @@ rstatus_i ring_array_pop(void *elem, struct ring_array *arr); /* creation/destruction */ struct ring_array *ring_array_create(size_t elem_size, uint32_t cap); + void ring_array_destroy(struct ring_array *arr); + +#ifdef __cplusplus +} +#endif diff --git a/include/hash/cc_murmur3.h b/include/hash/cc_murmur3.h index 8993e198a..8c736481d 100644 --- a/include/hash/cc_murmur3.h +++ b/include/hash/cc_murmur3.h @@ -16,11 +16,11 @@ */ /** - * The cc_murmur3.[ch] are adapated from the canonical implementation of + * The cc_murmur3.[ch] are adapted from the canonical implementation of * MurmurHash3 by Austin Appleby, released as part of SMHasher: * https://github.com/aappleby/smhasher * - * Changes include renaming fuctions, removing MSVC-related code, adding "static" + * Changes include renaming functions, removing MSVC-related code, adding "static" * keyword to local-scope functions according to C language spec (original code is * in C++), to better fit them into the scope and style of ccommon * @@ -29,11 +29,19 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #include -void hash_murmur3_32 ( const void * key, int len, uint32_t seed, void * out ); +void hash_murmur3_32(const void *key, int len, uint32_t seed, void *out); + +void hash_murmur3_128_x86(const void *key, int len, uint32_t seed, void *out); -void hash_murmur3_128_x86 ( const void * key, int len, uint32_t seed, void * out ); +void hash_murmur3_128_x64(const void *key, int len, uint32_t seed, void *out); -void hash_murmur3_128_x64 ( const void * key, int len, uint32_t seed, void * out ); +#ifdef __cplusplus +} +#endif