Mercurial > octave
changeset 28492:ae4cdbe75992
Use C++11 container for array of strings.
* libinterp/octave-value/ov-java.cc (get_jvm_lib_path_in_subdir): Use C++11
container for array of strings.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 20 Jun 2020 19:04:29 +0200 |
parents | d4e8887117b7 |
children | 75bb064c6769 |
files | libinterp/octave-value/ov-java.cc |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-java.cc Sat Jun 20 09:27:56 2020 -0700 +++ b/libinterp/octave-value/ov-java.cc Sat Jun 20 19:04:29 2020 +0200 @@ -37,6 +37,7 @@ #endif #include <algorithm> +#include <array> #include <fstream> #include <map> #include <string> @@ -513,16 +514,16 @@ // This assumes that whatever architectures are installed are appropriate for // this machine #if defined (OCTAVE_USE_WINDOWS_API) - std::string subdirs[] = {"bin/client", "bin/server"}; + const std::array<const std::string, 2> subdirs = {"bin/client", "bin/server"}; #else - std::string subdirs[] = {"jre/lib/server", "jre/lib", - "lib/client", "lib/server", - "jre/lib/amd64/client", "jre/lib/amd64/server", - "jre/lib/i386/client", "jre/lib/i386/server" - }; + const std::array<const std::string, 8> subdirs = + {"jre/lib/server", "jre/lib", "lib/client", "lib/server", + "jre/lib/amd64/client", "jre/lib/amd64/server", + "jre/lib/i386/client", "jre/lib/i386/server" + }; #endif - for (size_t i = 0; i < sizeof (subdirs) / sizeof (subdirs[0]); i++) + for (size_t i = 0; i < subdirs.size (); i++) { std::string candidate = java_home_path + "/" + subdirs[i] + "/" LIBJVM_FILE_NAME;