Skip to content

Commit

Permalink
add missing "extern C" qualifiers to a few headers for C++ linking; (t…
Browse files Browse the repository at this point in the history
…witter#150)

fix a few typos/style deviations
  • Loading branch information
synecdoche authored and thinkingfish committed Feb 5, 2018
1 parent a0aafdf commit 9406717
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
8 changes: 8 additions & 0 deletions include/cc_mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <cc_define.h>

#include <stddef.h>
Expand Down Expand Up @@ -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
8 changes: 8 additions & 0 deletions include/cc_rbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <cc_metric.h>

#include <stdint.h>
Expand Down Expand Up @@ -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
9 changes: 9 additions & 0 deletions include/cc_ring_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <cc_define.h>

#include <stddef.h>
Expand Down Expand Up @@ -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
18 changes: 13 additions & 5 deletions include/hash/cc_murmur3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -29,11 +29,19 @@

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>


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

0 comments on commit 9406717

Please sign in to comment.