You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2019/02/22 17:28:19 UTC
[couchdb-khash] 12/25: Support Windows build
This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-khash.git
commit 8d160efa340384d35a73f317193f711afff13992
Author: Joan Touzet <wo...@apache.org>
AuthorDate: Thu Jul 16 19:03:57 2015 -0400
Support Windows build
---
.gitignore | 1 +
c_src/khash.c | 17 +++++++++++------
rebar.config | 3 ++-
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/.gitignore b/.gitignore
index ff360df..7e47c63 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ test/*.beam
.eunit
.rebar
priv/*.so
+vc*.pdb
diff --git a/c_src/khash.c b/c_src/khash.c
index 6fbf463..b15a18e 100644
--- a/c_src/khash.c
+++ b/c_src/khash.c
@@ -9,6 +9,11 @@
#include "erl_nif.h"
#include "hash.h"
+#ifdef _WIN32
+#define INLINE __inline
+#else
+#define INLINE inline
+#endif
#define KHASH_VERSION 0
@@ -53,7 +58,7 @@ typedef struct
} khash_iter_t;
-static inline ERL_NIF_TERM
+static INLINE ERL_NIF_TERM
make_atom(ErlNifEnv* env, const char* name)
{
ERL_NIF_TERM ret;
@@ -64,21 +69,21 @@ make_atom(ErlNifEnv* env, const char* name)
}
-static inline ERL_NIF_TERM
+static INLINE ERL_NIF_TERM
make_ok(ErlNifEnv* env, khash_priv* priv, ERL_NIF_TERM value)
{
return enif_make_tuple2(env, priv->atom_ok, value);
}
-static inline ERL_NIF_TERM
+static INLINE ERL_NIF_TERM
make_error(ErlNifEnv* env, khash_priv* priv, ERL_NIF_TERM reason)
{
return enif_make_tuple2(env, priv->atom_error, reason);
}
-static inline int
+static INLINE int
check_pid(ErlNifEnv* env, khash_t* khash)
{
ErlNifPid pid;
@@ -144,7 +149,7 @@ khash_hash_fun(const void* obj)
}
-static inline khash_t*
+static INLINE khash_t*
khash_create_int(ErlNifEnv* env, khash_priv* priv, ERL_NIF_TERM opts)
{
khash_t* khash = NULL;
@@ -278,7 +283,7 @@ khash_clear(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
}
-static inline hnode_t*
+static INLINE hnode_t*
khash_lookup_int(ErlNifEnv* env, uint32_t hv, ERL_NIF_TERM key, khash_t* khash)
{
khnode_t node;
diff --git a/rebar.config b/rebar.config
index 59a612b..cfbeaeb 100644
--- a/rebar.config
+++ b/rebar.config
@@ -7,6 +7,7 @@
% {".*", "CFLAGS", "$CFLAGS -g -Wall -Werror -fPIC"}
% Production compilation
- {".*", "CFLAGS", "$CFLAGS -Wall -Werror -DNDEBUG -O3"}
+ {"(linux|solaris|darwin|freebsd)", "CFLAGS", "$CFLAGS -Wall -Werror -DNDEBUG -O3"},
+ {"win32", "CFLAGS", "$CFLAGS /O2 /DNDEBUG /Wall"}
]}.