Skip to content

Commit cdc30d8

Browse files
committed
improve: make art_method_size and entry_point_offset local
This commit makes the two variables from "art_method.h" since they were only accessed in one function anyway, rendering unecessary to keep them global.
1 parent d592cd9 commit cdc30d8

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎loader/src/injector/art_method.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include "logging.h"
1111

1212
static jfieldID art_method_field = NULL;
13-
static size_t art_method_size = 0;
14-
static size_t entry_point_offset = 0;
1513
static size_t data_offset = 0;
1614

1715
static inline void *amethod_from_reflected_method(JNIEnv *env, jobject method);
@@ -84,15 +82,15 @@ static inline bool amethod_init(JNIEnv *env) {
8482
(*env)->DeleteLocalRef(env, constructors);
8583
if (clazz) (*env)->DeleteLocalRef(env, clazz);
8684

87-
art_method_size = second - first;
85+
size_t art_method_size = second - first;
8886
LOGD("ArtMethod size: %zu", art_method_size);
8987
if ((4 * 9 + 3 * sizeof(void *)) < art_method_size) {
9088
LOGE("ArtMethod size exceeds maximum assume. There may be something wrong.");
9189

9290
return false;
9391
}
9492

95-
entry_point_offset = art_method_size - sizeof(void *);
93+
size_t entry_point_offset = art_method_size - sizeof(void *);
9694
data_offset = entry_point_offset - sizeof(void *);
9795
LOGD("ArtMethod entrypoint offset: %zu", entry_point_offset);
9896
LOGD("ArtMethod data offset: %zu", data_offset);

0 commit comments

Comments
 (0)