hotspot/src/share/vm/services/writeableFlags.cpp
changeset 38942 a4b3fc1ba095
parent 33604 ad1cd9269bd4
child 46630 75aa3e39d02c
equal deleted inserted replaced
38941:adfac609d052 38942:a4b3fc1ba095
    91   err_msg.print("%s", buffer);
    91   err_msg.print("%s", buffer);
    92 }
    92 }
    93 
    93 
    94 // set a boolean global flag
    94 // set a boolean global flag
    95 Flag::Error WriteableFlags::set_bool_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
    95 Flag::Error WriteableFlags::set_bool_flag(const char* name, const char* arg, Flag::Flags origin, FormatBuffer<80>& err_msg) {
    96   int value = true;
    96   if ((strcasecmp(arg, "true") == 0) || (*arg == '1' && *(arg + 1) == 0)) {
    97 
    97     return set_bool_flag(name, true, origin, err_msg);
    98   if (sscanf(arg, "%d", &value)) {
    98   } else if ((strcasecmp(arg, "false") == 0) || (*arg == '0' && *(arg + 1) == 0)) {
    99     return set_bool_flag(name, value != 0, origin, err_msg);
    99     return set_bool_flag(name, false, origin, err_msg);
   100   }
   100   }
   101   err_msg.print("flag value must be a boolean (1 or 0)");
   101   err_msg.print("flag value must be a boolean (1/0 or true/false)");
   102   return Flag::WRONG_FORMAT;
   102   return Flag::WRONG_FORMAT;
   103 }
   103 }
   104 
   104 
   105 Flag::Error WriteableFlags::set_bool_flag(const char* name, bool value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
   105 Flag::Error WriteableFlags::set_bool_flag(const char* name, bool value, Flag::Flags origin, FormatBuffer<80>& err_msg) {
   106   Flag::Error err = CommandLineFlags::boolAtPut(name, &value, origin);
   106   Flag::Error err = CommandLineFlags::boolAtPut(name, &value, origin);