< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page

 924   if (JVMFlag::ccstrAt(flag, &old_value) != JVMFlag::SUCCESS) return false;
 925   size_t old_len = old_value != NULL ? strlen(old_value) : 0;
 926   size_t new_len = strlen(new_value);
 927   const char* value;
 928   char* free_this_too = NULL;
 929   if (old_len == 0) {
 930     value = new_value;
 931   } else if (new_len == 0) {
 932     value = old_value;
 933   } else {
 934      size_t length = old_len + 1 + new_len + 1;
 935      char* buf = NEW_C_HEAP_ARRAY(char, length, mtArguments);
 936     // each new setting adds another LINE to the switch:
 937     jio_snprintf(buf, length, "%s\n%s", old_value, new_value);
 938     value = buf;
 939     free_this_too = buf;
 940   }
 941   (void) JVMFlag::ccstrAtPut(flag, &value, origin);
 942   // JVMFlag always returns a pointer that needs freeing.
 943   FREE_C_HEAP_ARRAY(char, value);
 944   if (free_this_too != NULL) {
 945     // JVMFlag made its own copy, so I must delete my own temp. buffer.
 946     FREE_C_HEAP_ARRAY(char, free_this_too);
 947   }
 948   return true;
 949 }
 950 
 951 const char* Arguments::handle_aliases_and_deprecation(const char* arg, bool warn) {
 952   const char* real_name = real_flag_name(arg);
 953   JDK_Version since = JDK_Version();
 954   switch (is_deprecated_flag(arg, &since)) {
 955     case -1:
 956       return NULL; // obsolete or expired, don't process normally
 957     case 0:
 958       return real_name;
 959     case 1: {
 960       if (warn) {
 961         char version[256];
 962         since.to_string(version, sizeof(version));
 963         if (real_name != arg) {
 964           warning("Option %s was deprecated in version %s and will likely be removed in a future release. Use option %s instead.",
 965                   arg, version, real_name);
 966         } else {
 967           warning("Option %s was deprecated in version %s and will likely be removed in a future release.",

 924   if (JVMFlag::ccstrAt(flag, &old_value) != JVMFlag::SUCCESS) return false;
 925   size_t old_len = old_value != NULL ? strlen(old_value) : 0;
 926   size_t new_len = strlen(new_value);
 927   const char* value;
 928   char* free_this_too = NULL;
 929   if (old_len == 0) {
 930     value = new_value;
 931   } else if (new_len == 0) {
 932     value = old_value;
 933   } else {
 934      size_t length = old_len + 1 + new_len + 1;
 935      char* buf = NEW_C_HEAP_ARRAY(char, length, mtArguments);
 936     // each new setting adds another LINE to the switch:
 937     jio_snprintf(buf, length, "%s\n%s", old_value, new_value);
 938     value = buf;
 939     free_this_too = buf;
 940   }
 941   (void) JVMFlag::ccstrAtPut(flag, &value, origin);
 942   // JVMFlag always returns a pointer that needs freeing.
 943   FREE_C_HEAP_ARRAY(char, value);
 944   // JVMFlag made its own copy, so I must delete my own temp. buffer.
 945   FREE_C_HEAP_ARRAY(char, free_this_too);


 946   return true;
 947 }
 948 
 949 const char* Arguments::handle_aliases_and_deprecation(const char* arg, bool warn) {
 950   const char* real_name = real_flag_name(arg);
 951   JDK_Version since = JDK_Version();
 952   switch (is_deprecated_flag(arg, &since)) {
 953     case -1:
 954       return NULL; // obsolete or expired, don't process normally
 955     case 0:
 956       return real_name;
 957     case 1: {
 958       if (warn) {
 959         char version[256];
 960         since.to_string(version, sizeof(version));
 961         if (real_name != arg) {
 962           warning("Option %s was deprecated in version %s and will likely be removed in a future release. Use option %s instead.",
 963                   arg, version, real_name);
 964         } else {
 965           warning("Option %s was deprecated in version %s and will likely be removed in a future release.",
< prev index next >