src/share/vm/compiler/directivesParser.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8138651 Sdiff src/share/vm/compiler

src/share/vm/compiler/directivesParser.cpp

Print this page




 271         }
 272         error(VALUE_ERROR, "Cannot use int value for an %s flag", flag_type_names[option_key->flag_type]);
 273         return false;
 274       } else {
 275         intx ival = v->int_value;
 276         (set->*test)((void *)&ival);
 277       }
 278       break;
 279 
 280     case JSON_NUMBER_FLOAT:
 281       if (option_key->flag_type != doubleFlag) {
 282         error(VALUE_ERROR, "Cannot use double value for an %s flag", flag_type_names[option_key->flag_type]);
 283         return false;
 284       } else {
 285         double dval = v->double_value;
 286         (set->*test)((void *)&dval);
 287       }
 288       break;
 289 
 290     case JSON_STRING:
 291       if (option_key->flag_type != ccstrFlag) {
 292         error(VALUE_ERROR, "Cannot use string value for a %s flag", flag_type_names[option_key->flag_type]);
 293         return false;
 294       } else {
 295         char* s = NEW_C_HEAP_ARRAY(char, v->str.length+1,  mtCompiler);
 296         strncpy(s, v->str.start, v->str.length + 1);
 297         s[v->str.length] = '\0';
 298         (set->*test)((void *)&s);
 299       }
 300       break;
 301 
 302     default:
 303       assert(0, "Should not reach here.");
 304     }
 305   return true;
 306 }
 307 
 308 bool DirectivesParser::set_option(JSON_TYPE t, JSON_VAL* v) {
 309 
 310   const key* option_key = pop_key();
 311   const key* enclosing_key = current_key();




 271         }
 272         error(VALUE_ERROR, "Cannot use int value for an %s flag", flag_type_names[option_key->flag_type]);
 273         return false;
 274       } else {
 275         intx ival = v->int_value;
 276         (set->*test)((void *)&ival);
 277       }
 278       break;
 279 
 280     case JSON_NUMBER_FLOAT:
 281       if (option_key->flag_type != doubleFlag) {
 282         error(VALUE_ERROR, "Cannot use double value for an %s flag", flag_type_names[option_key->flag_type]);
 283         return false;
 284       } else {
 285         double dval = v->double_value;
 286         (set->*test)((void *)&dval);
 287       }
 288       break;
 289 
 290     case JSON_STRING:
 291       if (option_key->flag_type != ccstrFlag && option_key->flag_type != ccstrlistFlag) {
 292         error(VALUE_ERROR, "Cannot use string value for a %s flag", flag_type_names[option_key->flag_type]);
 293         return false;
 294       } else {
 295         char* s = NEW_C_HEAP_ARRAY(char, v->str.length+1,  mtCompiler);
 296         strncpy(s, v->str.start, v->str.length + 1);
 297         s[v->str.length] = '\0';
 298         (set->*test)((void *)&s);
 299       }
 300       break;
 301 
 302     default:
 303       assert(0, "Should not reach here.");
 304     }
 305   return true;
 306 }
 307 
 308 bool DirectivesParser::set_option(JSON_TYPE t, JSON_VAL* v) {
 309 
 310   const key* option_key = pop_key();
 311   const key* enclosing_key = current_key();


src/share/vm/compiler/directivesParser.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File