32
32
#include " JVMTITools.h"
33
33
#include " native_thread.h"
34
34
35
- #ifdef __cplusplus
36
35
extern " C" {
37
- #endif
38
36
39
- #ifndef JNI_ENV_ARG
40
- #ifdef __cplusplus
41
- #define JNI_ENV_ARG (x, y ) y
42
- #define JNI_ENV_PTR (x ) x
43
- #else
44
- #define JNI_ENV_ARG (x, y ) x, y
45
- #define JNI_ENV_PTR (x ) (*x)
46
- #endif
47
- #endif
48
37
49
38
#ifndef JNI_ENV_ARG1
50
39
#ifdef __cplusplus
@@ -95,16 +84,14 @@ static void doRedirect(JNIEnv *env) {
95
84
result = STATUS_FAILED;
96
85
printf (" (%s,%d): TEST FAILED: failed to get original JNI function table: %s\n " ,
97
86
__FILE__, __LINE__, TranslateError (err));
98
- JNI_ENV_PTR (env)->FatalError (JNI_ENV_ARG (env,
99
- " failed to get original JNI function table" ));
87
+ env->FatalError (" failed to get original JNI function table" );
100
88
}
101
89
if ((err = jvmti->GetJNIFunctionTable (&redir_jni_functions)) !=
102
90
JVMTI_ERROR_NONE) {
103
91
result = STATUS_FAILED;
104
92
printf (" (%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n " ,
105
93
__FILE__, __LINE__, TranslateError (err));
106
- JNI_ENV_PTR (env)->FatalError (JNI_ENV_ARG (env,
107
- " failed to get redirected JNI function table" ));
94
+ env->FatalError (" failed to get redirected JNI function table" );
108
95
}
109
96
if (verbose)
110
97
printf (" doRedirect: the JNI function table obtained successfully\n " );
@@ -118,8 +105,7 @@ static void doRedirect(JNIEnv *env) {
118
105
result = STATUS_FAILED;
119
106
printf (" (%s,%d): TEST FAILED: failed to get new JNI function table: %s\n " ,
120
107
__FILE__, __LINE__, TranslateError (err));
121
- JNI_ENV_PTR (env)->FatalError (JNI_ENV_ARG (env,
122
- " failed to get new JNI function table" ));
108
+ env->FatalError (" failed to get new JNI function table" );
123
109
}
124
110
125
111
if (verbose)
@@ -136,8 +122,7 @@ static void doRestore(JNIEnv *env) {
136
122
result = STATUS_FAILED;
137
123
printf (" (%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n " ,
138
124
__FILE__, __LINE__, TranslateError (err));
139
- JNI_ENV_PTR (env)->FatalError (JNI_ENV_ARG (env,
140
- " failed to restore original JNI function table" ));
125
+ env->FatalError (" failed to restore original JNI function table" );
141
126
}
142
127
if (verbose)
143
128
printf (" doRestore: the original JNI function table is restored successfully\n " );
@@ -155,8 +140,7 @@ static void checkRedir(JNIEnv *env, int exCalls) {
155
140
result = STATUS_FAILED;
156
141
printf (" (%s,%d): TEST FAILED: failed to get modified JNI function table: %s\n " ,
157
142
__FILE__, __LINE__, TranslateError (err));
158
- JNI_ENV_PTR (env)->FatalError (JNI_ENV_ARG (env,
159
- " failed to get modified JNI function table" ));
143
+ env->FatalError (" failed to get modified JNI function table" );
160
144
}
161
145
if (verbose)
162
146
printf (" checkRedir: the JNI function table obtained successfully\n\t calling GetVersion() ...\n " );
@@ -222,8 +206,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
222
206
if (verbose)
223
207
printf (" verbose mode on\n " );
224
208
225
- res = JNI_ENV_PTR (jvm)->
226
- GetEnv (JNI_ENV_ARG (jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
209
+ res = jvm->GetEnv ((void **) &jvmti, JVMTI_VERSION_1_1);
227
210
if (res != JNI_OK || jvmti == NULL ) {
228
211
printf (" (%s,%d): Failed to call GetEnv\n " , __FILE__, __LINE__);
229
212
return JNI_ERR;
@@ -232,6 +215,4 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
232
215
return JNI_OK;
233
216
}
234
217
235
- #ifdef __cplusplus
236
218
}
237
- #endif
0 commit comments