Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added EMONK_DISABLED preprocessor flag

Allows emonk to be disabled, duh. Makes the final app 1MB
smaller. There's nothing to turn this flag on yet, though.

Change-Id: I984fa7e6d5d7e94070cdd6f8dc71a9044b220821
Reviewed-on: http://review.couchbase.org/10024
Reviewed-by: Chris Anderson <jchris@couchbase.com>
Tested-by: Jens Alfke <jens@couchbase.com>
  • Loading branch information...
commit c0a06fae78b376018be025fb5c7c11af0caff978 1 parent cba0f67
@snej snej authored
View
3  src/emonk_main.c
@@ -6,6 +6,8 @@
#include "util.h"
#include "vm.h"
+#ifndef EMONK_DISABLED
+
#define GC_THRESHOLD 10485760 // 10 MiB
#define MAX_BYTES 8388608
#define MAX_MALLOC_BYTES 8388608
@@ -203,3 +205,4 @@ static ErlNifFunc nif_funcs[] = {
ERL_NIF_INIT(emonk, nif_funcs, &load, NULL, NULL, unload);
+#endif // EMONK_ENABLED
View
6 src/emulator/sys/unix/erl_unix_sys_ddll.c
@@ -105,10 +105,12 @@ void erl_sys_ddll_init(void) {
int erts_sys_ddll_open2(char *full_name, void **handle, ErtsSysDdllError* err)
{
fprintf(stderr, "Dynamic load attempt: %s\n", full_name);
+#ifndef EMONK_DISABLED
if(strcmp("emonk", full_name) == 0) {
*handle = (void*) 1;
return ERL_DE_NO_ERROR;
}
+#endif
if(strcmp("ejson", full_name) == 0) {
*handle = (void*) 2;
return ERL_DE_NO_ERROR;
@@ -165,12 +167,14 @@ ErlNifEntry* snappy_init(void);
ErlNifEntry* couch_ios_init(void);
int erts_sys_ddll_load_nif_init(void *handle, void **function, ErtsSysDdllError* err)
{
- int res = ERL_DE_ERROR_NO_DDLL_FUNCTIONALITY;;
+ int res = ERL_DE_ERROR_NO_DDLL_FUNCTIONALITY;
+#ifndef EMONK_DISABLED
if((size_t)handle == 1) {
fprintf(stderr, "Loaded NIF: emonk.\n");
*function = emonk_init;
res = ERL_DE_NO_ERROR;
}
+#endif
if((size_t)handle == 2) {
fprintf(stderr, "Loaded NIF: ejson.\n");
*function = ejson_init;
View
4 src/util.c
@@ -27,6 +27,8 @@ util_mk_error(ErlNifEnv* env, const char* reason)
return enif_make_tuple2(env, error, util_mk_atom(env, reason));
}
+#ifndef EMONK_DISABLED
+
void
util_debug_jsval(JSContext* cx, jsval val)
{
@@ -49,3 +51,5 @@ util_debug_jsval(JSContext* cx, jsval val)
fprintf(stderr, "%s\n", bytes);
}
+
+#endif
Please sign in to comment.
Something went wrong with that request. Please try again.