Skip to content

Commit

Permalink
Add new macro to create a local reference from a weak reference
Browse files Browse the repository at this point in the history
  • Loading branch information
normanmaurer committed Sep 1, 2023
1 parent eaa83a9 commit 4a2b73c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/c/netty_jni_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
NETTY_JNI_UTIL_END_MACRO


#define NETTY_JNI_UTIL_NEW_LOCAL_FROM_WEAK(E, C, W, R) \
NETTY_JNI_UTIL_BEGIN_MACRO \
C = (*(E))->NewLocalRef((E), W); \
if ((*(E))->IsSameObject((E), C, NULL) || C == NULL) { \
goto R; \
} \
NETTY_JNI_UTIL_END_MACRO

#define NETTY_JNI_UTIL_GET_METHOD(E, C, M, N, S, R) \
NETTY_JNI_UTIL_BEGIN_MACRO \
M = (*(E))->GetMethodID((E), C, N, S); \
Expand Down

0 comments on commit 4a2b73c

Please sign in to comment.