< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp

Print this page
rev 52285 : 8212884: Remove the assignments in ifs for vmTestbase/[a-s]
Summary: Extract assignments from if statements in vmTestbase
Reviewed-by: cjplummer, sspitsyn

@@ -49,11 +49,12 @@
         jclass klass) {
     char className[MAX_STRING_LENGTH];
     const char* agentName;
     Options* options;
 
-    if (!NSK_VERIFY((options = nsk_jvmti_aod_getMultiagentsOptions(jvmti)) != NULL)) {
+    options = nsk_jvmti_aod_getMultiagentsOptions(jvmti);
+    if (!NSK_VERIFY(options != NULL)) {
         NSK_COMPLAIN0("Failed to get agents's options\n");
         nsk_jvmti_aod_disableEvent(jvmti, JVMTI_EVENT_CLASS_LOAD);
         // can't call nsk_aod_agentFinished because of without options can't get agent's name
         return;
     }

@@ -98,19 +99,22 @@
     jvmtiEnv* jvmti = NULL;
     JNIEnv* jni = NULL;
     Options* options;
     const char* agentName;
 
-    if (!NSK_VERIFY((options = (Options*) nsk_aod_createOptions(optionsString)) != NULL))
+    options = (Options*) nsk_aod_createOptions(optionsString);
+    if (!NSK_VERIFY(options != NULL))
         return JNI_ERR;
 
     agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION);
 
-    if ((jni = (JNIEnv*) nsk_aod_createJNIEnv(vm)) == NULL)
+    jni = (JNIEnv*) nsk_aod_createJNIEnv(vm);
+    if (jni == NULL)
         return NSK_FALSE;
 
-    if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
+    jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved);
+    if (!NSK_VERIFY(jvmti != NULL))
         return JNI_ERR;
 
     memset(&caps, 0, sizeof(caps));
     caps.can_redefine_classes = 1;
     if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
< prev index next >