Permalink
Browse files

Fix wrong declarations

(now down to 35 missing NIF API functions)
  • Loading branch information...
krestenkrab committed Sep 16, 2013
1 parent c2587fa commit 7a1c5ef0db04cd24b266b21fa81a4cb78f87188d
Showing with 7 additions and 8 deletions.
  1. +4 −5 jnif/jnif_process.cc
  2. +3 −3 jnif/jnif_resource.cc
View
@@ -3,7 +3,6 @@
#include "jnif.h"
-
static jmethodID m_eobject__testPID;
static jmethodID m_eobject__testInternalPID;
static jclass NIF_class;
@@ -19,12 +18,12 @@ static jmethodID m_eproc__key;
// valid for the life time of the given environment; otherwise it
// will have to be copied.
//
-ErlNifPid* enif_self(ErlNifEnv* ee)
+ErlNifPid* enif_self(ErlNifEnv* ee, ErlNifPid* pid)
{
if (ee->self == NULL) return NULL;
jlong key = ee->je->CallIntMethod( ee->self, m_eproc__key );
- ee->self_pid.pid = key;
- return &ee->self_pid;
+ pid->pid = key;
+ return pid;
}
int enif_get_local_pid(ErlNifEnv* ee, ERL_NIF_TERM term, ErlNifPid* pid)
@@ -48,7 +47,7 @@ int enif_is_pid(ErlNifEnv* ee, ERL_NIF_TERM term)
}
}
-int enif_send(ErlNifEnv* ee, ErlNifPid* to_pid,
+extern "C" int enif_send(ErlNifEnv* ee, const ErlNifPid* to_pid,
ErlNifEnv* msg_env, ERL_NIF_TERM msg)
{
JNIEnv* je = ee->je;
View
@@ -88,7 +88,7 @@ void* enif_alloc_resource(ErlNifResourceType* type, size_t size)
}
-static int enif_release_resource2(JNIEnv *je, void* obj)
+static int jnif_release_resource(JNIEnv *je, void* obj)
{
struct jnif_resource_hdr *hdr = get(obj);
@@ -118,7 +118,7 @@ void enif_release_resource(void* obj)
{
JNIEnv *je;
jvm->AttachCurrentThreadAsDaemon((void**)&je, NULL);
- enif_release_resource2(je, obj);
+ jnif_release_resource(je, obj);
}
@@ -184,7 +184,7 @@ JNIEXPORT void JNICALL Java_erjang_EResource_jni_1finalize
const char *rnam = hdr->type->name_str;
fprintf(stderr, "finalize(%p) %s:%s\n", (void*)handle, mod, rnam);
#endif
- int did_free = enif_release_resource2(je, (void*)handle);
+ int did_free = jnif_release_resource(je, (void*)handle);
#ifdef DEBUG
fprintf(stderr, " -> done (%s)\n", did_free ? "feed" : "retained");
#endif

0 comments on commit 7a1c5ef

Please sign in to comment.