mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-08 05:58:38 +00:00
8200384: jcmd help output should be sorted
Reviewed-by: sspitsyn, clanger
This commit is contained in:
parent
c130c8137f
commit
397e628d12
@ -137,9 +137,15 @@ HelpDCmd::HelpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, hea
|
||||
_dcmdparser.add_dcmd_argument(&_cmd);
|
||||
};
|
||||
|
||||
|
||||
static int compare_strings(const char** s1, const char** s2) {
|
||||
return ::strcmp(*s1, *s2);
|
||||
}
|
||||
|
||||
void HelpDCmd::execute(DCmdSource source, TRAPS) {
|
||||
if (_all.value()) {
|
||||
GrowableArray<const char*>* cmd_list = DCmdFactory::DCmd_list(source);
|
||||
cmd_list->sort(compare_strings);
|
||||
for (int i = 0; i < cmd_list->length(); i++) {
|
||||
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i),
|
||||
strlen(cmd_list->at(i)));
|
||||
@ -180,6 +186,7 @@ void HelpDCmd::execute(DCmdSource source, TRAPS) {
|
||||
} else {
|
||||
output()->print_cr("The following commands are available:");
|
||||
GrowableArray<const char *>* cmd_list = DCmdFactory::DCmd_list(source);
|
||||
cmd_list->sort(compare_strings);
|
||||
for (int i = 0; i < cmd_list->length(); i++) {
|
||||
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i),
|
||||
strlen(cmd_list->at(i)));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user