OpenJDK / jdk / hs
changeset 49675:bdcfe8154201
8200384: jcmd help output should be sorted
Reviewed-by: sspitsyn, clanger
author | stuefe |
---|---|
date | Wed, 28 Mar 2018 22:03:57 +0200 |
parents | bebec5011846 |
children | c3a10df652c0 |
files | src/hotspot/share/services/diagnosticCommand.cpp |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/share/services/diagnosticCommand.cpp Wed Apr 11 20:56:56 2018 +0300 +++ b/src/hotspot/share/services/diagnosticCommand.cpp Wed Mar 28 22:03:57 2018 +0200 @@ -137,9 +137,15 @@ _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 @@ } 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)));