From 869a33eb134a7cb50592c78ff7e4bc127956af8d Mon Sep 17 00:00:00 2001 From: Sidharth Guglani Date: Thu, 10 Oct 2019 05:31:30 -0700 Subject: [PATCH] no need to pass env to ref method , we can directly use getCurrentEnv() Summary: We can use getCurrentEnv() instead of passing environment variable around Reviewed By: amir-shalem Differential Revision: D17842042 fbshipit-source-id: 185b174ae7c08e746bc76c0600c2e326b15c4993 --- java/jni/YGJNIVanilla.cpp | 3 +-- java/jni/YGJTypesVanilla.h | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/jni/YGJNIVanilla.cpp b/java/jni/YGJNIVanilla.cpp index 31ad05aa..555a13c7 100644 --- a/java/jni/YGJNIVanilla.cpp +++ b/java/jni/YGJNIVanilla.cpp @@ -21,8 +21,7 @@ using facebook::yoga::detail::Log; static inline ScopedLocalRef YGNodeJobject( YGNodeRef node, void* layoutContext) { - return reinterpret_cast(layoutContext) - ->ref(getCurrentEnv(), node); + return reinterpret_cast(layoutContext)->ref(node); } static inline YGNodeRef _jlong2YGNodeRef(jlong addr) { diff --git a/java/jni/YGJTypesVanilla.h b/java/jni/YGJTypesVanilla.h index 33d9c060..9de9a56c 100644 --- a/java/jni/YGJTypesVanilla.h +++ b/java/jni/YGJTypesVanilla.h @@ -29,7 +29,8 @@ public: } } - ScopedLocalRef ref(JNIEnv* env, YGNodeRef node) { + ScopedLocalRef ref(YGNodeRef node) { + JNIEnv* env = getCurrentEnv(); auto idx = ptrsToIdxs_.find(node); if (idx == ptrsToIdxs_.end()) { return ScopedLocalRef(env);