3458 } else { 3459 // clean up previously allocated memory. 3460 for (int j=0; j<i; j++) { 3461 Deallocate((unsigned char*)*property_ptr+j); 3462 } 3463 Deallocate((unsigned char*)property_ptr); 3464 break; 3465 } 3466 } 3467 return err; 3468 } /* end GetSystemProperties */ 3469 3470 3471 // property - pre-checked for NULL 3472 // value_ptr - pre-checked for NULL 3473 jvmtiError 3474 JvmtiEnv::GetSystemProperty(const char* property, char** value_ptr) { 3475 jvmtiError err = JVMTI_ERROR_NONE; 3476 const char *value; 3477 3478 value = Arguments::PropertyList_get_value(Arguments::system_properties(), property); 3479 if (value == NULL) { 3480 err = JVMTI_ERROR_NOT_AVAILABLE; 3481 } else { 3482 err = allocate((strlen(value)+1) * sizeof(char), (unsigned char **)value_ptr); 3483 if (err == JVMTI_ERROR_NONE) { 3484 strcpy(*value_ptr, value); 3485 } 3486 } 3487 return err; 3488 } /* end GetSystemProperty */ 3489 3490 3491 // property - pre-checked for NULL 3492 // value - NULL is a valid value, must be checked 3493 jvmtiError 3494 JvmtiEnv::SetSystemProperty(const char* property, const char* value_ptr) { 3495 jvmtiError err =JVMTI_ERROR_NOT_AVAILABLE; 3496 3497 for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) { | 3458 } else { 3459 // clean up previously allocated memory. 3460 for (int j=0; j<i; j++) { 3461 Deallocate((unsigned char*)*property_ptr+j); 3462 } 3463 Deallocate((unsigned char*)property_ptr); 3464 break; 3465 } 3466 } 3467 return err; 3468 } /* end GetSystemProperties */ 3469 3470 3471 // property - pre-checked for NULL 3472 // value_ptr - pre-checked for NULL 3473 jvmtiError 3474 JvmtiEnv::GetSystemProperty(const char* property, char** value_ptr) { 3475 jvmtiError err = JVMTI_ERROR_NONE; 3476 const char *value; 3477 3478 if (Arguments::is_internal_module_property(property)) { 3479 return JVMTI_ERROR_NOT_AVAILABLE; 3480 } 3481 value = Arguments::PropertyList_get_value(Arguments::system_properties(), property); 3482 if (value == NULL) { 3483 err = JVMTI_ERROR_NOT_AVAILABLE; 3484 } else { 3485 err = allocate((strlen(value)+1) * sizeof(char), (unsigned char **)value_ptr); 3486 if (err == JVMTI_ERROR_NONE) { 3487 strcpy(*value_ptr, value); 3488 } 3489 } 3490 return err; 3491 } /* end GetSystemProperty */ 3492 3493 3494 // property - pre-checked for NULL 3495 // value - NULL is a valid value, must be checked 3496 jvmtiError 3497 JvmtiEnv::SetSystemProperty(const char* property, const char* value_ptr) { 3498 jvmtiError err =JVMTI_ERROR_NOT_AVAILABLE; 3499 3500 for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) { |