diff options
-rw-r--r-- | src/main/cpp/blaze.cc | 2 | ||||
-rw-r--r-- | src/main/cpp/blaze_util.cc | 14 | ||||
-rw-r--r-- | src/main/cpp/blaze_util.h | 11 | ||||
-rw-r--r-- | src/main/cpp/option_processor.cc | 4 | ||||
-rw-r--r-- | src/main/cpp/option_processor.h | 3 |
5 files changed, 19 insertions, 15 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc index edc9f2c9f3..42dcda03d9 100644 --- a/src/main/cpp/blaze.cc +++ b/src/main/cpp/blaze.cc @@ -1325,7 +1325,7 @@ static void ComputeWorkspace() { // Figure out the base directories based on embedded data, username, cwd, etc. // Sets globals->options.install_base, globals->options.output_base, // globals->lock_file, globals->jvm_log_file. -static void ComputeBaseDirectories(const string self_path) { +static void ComputeBaseDirectories(const string &self_path) { // Only start a server when in a workspace because otherwise we won't do more // than emit a help message. if (!BlazeStartupOptions::InWorkspace(globals->workspace)) { diff --git a/src/main/cpp/blaze_util.cc b/src/main/cpp/blaze_util.cc index f50023c4b8..d9f593e28f 100644 --- a/src/main/cpp/blaze_util.cc +++ b/src/main/cpp/blaze_util.cc @@ -63,7 +63,7 @@ string GetUserName() { // If called from working directory "/bar": // MakeAbsolute("foo") --> "/bar/foo" // MakeAbsolute("/foo") ---> "/foo" -string MakeAbsolute(string path) { +string MakeAbsolute(const string &path) { // Check if path is already absolute. if (path.empty() || path[0] == '/') { return path; @@ -241,7 +241,7 @@ int GetTerminalColumns() { // Replace the current process with the given program in the given working // directory, using the given argument vector. // This function does not return on success. -void ExecuteProgram(string exe, const vector<string>& args_vector) { +void ExecuteProgram(const string& exe, const vector<string>& args_vector) { if (VerboseLogging()) { string dbg; for (const auto& s : args_vector) { @@ -278,8 +278,9 @@ void ReExecute(const string &executable, int argc, const char *argv[]) { ExecuteProgram(args[0], args); } -const char* GetUnaryOption(const char *arg, const char *next_arg, - const char *key) { +const char* GetUnaryOption(const char *arg, + const char *next_arg, + const char *key) { const char *value = blaze_util::var_strprefix(arg, key); if (value == NULL) { return NULL; @@ -343,7 +344,7 @@ string ReadJvmVersion(int fd) { return ""; } -string GetJvmVersion(string java_exe) { +string GetJvmVersion(const string &java_exe) { vector<string> args; args.push_back("java"); args.push_back("-version"); @@ -370,7 +371,8 @@ string GetJvmVersion(string java_exe) { } } -bool CheckJavaVersionIsAtLeast(string jvm_version, string version_spec) { +bool CheckJavaVersionIsAtLeast(const string &jvm_version, + const string &version_spec) { vector<string> jvm_version_vect = blaze_util::Split(jvm_version, '.'); vector<string> version_spec_vect = blaze_util::Split(version_spec, '.'); int i; diff --git a/src/main/cpp/blaze_util.h b/src/main/cpp/blaze_util.h index b135a967ec..3870ce3d13 100644 --- a/src/main/cpp/blaze_util.h +++ b/src/main/cpp/blaze_util.h @@ -36,11 +36,11 @@ string GetUserName(); // If called from working directory "/bar": // MakeAbsolute("foo") --> "/bar/foo" // MakeAbsolute("/foo") ---> "/foo" -string MakeAbsolute(string path); +string MakeAbsolute(const string &path); // mkdir -p path. All newly created directories use the given mode. // Returns -1 on failure, sets errno. -int MakeDirectories(const string& path, mode_t mode); +int MakeDirectories(const string &path, mode_t mode); // Replaces 'content' with contents of file 'filename'. // Returns false on error. @@ -69,7 +69,7 @@ bool Is64BitBlazeJavabase(); void AddJVMSpecificArguments(const string &host_javabase, std::vector<string> *result); -void ExecuteProgram(string exe, const std::vector<string>& args_vector); +void ExecuteProgram(const string &exe, const std::vector<string> &args_vector); void ReExecute(const string &executable, int argc, const char *argv[]); @@ -101,14 +101,15 @@ string ReadJvmVersion(int fd); // is supposed to output a string in the form '.*version ".*".*'. This method // will return the part in between the two quote or the empty string on failure // to match the good string. -string GetJvmVersion(string java_exe); +string GetJvmVersion(const string &java_exe); // Returns true iff jvm_version is at least the version specified by // version_spec. // jvm_version is supposed to be a string specifying a java runtime version // as specified by the JSR-56 appendix A. version_spec is supposed to be a // version is the format [0-9]+(.[1-9]+)*. -bool CheckJavaVersionIsAtLeast(string jvm_version, string version_spec); +bool CheckJavaVersionIsAtLeast(const string &jvm_version, + const string &version_spec); } // namespace blaze diff --git a/src/main/cpp/option_processor.cc b/src/main/cpp/option_processor.cc index d33554b513..9500cf4bba 100644 --- a/src/main/cpp/option_processor.cc +++ b/src/main/cpp/option_processor.cc @@ -41,7 +41,6 @@ OptionProcessor::RcOption::RcOption(int rcfile_index, const string& option) { option_ = option; } - OptionProcessor::RcFile::RcFile(const string& filename, int index) { filename_ = filename; index_ = index; @@ -58,7 +57,8 @@ blaze_exit_code::ExitCode OptionProcessor::RcFile::Parse( } blaze_exit_code::ExitCode OptionProcessor::RcFile::Parse( - string filename, const int index, + const string& filename, + const int index, vector<RcFile>* rcfiles, map<string, vector<RcOption> >* rcoptions, list<string>* import_stack, diff --git a/src/main/cpp/option_processor.h b/src/main/cpp/option_processor.h index 9bc7a381ea..15724e8ff1 100644 --- a/src/main/cpp/option_processor.h +++ b/src/main/cpp/option_processor.h @@ -94,7 +94,8 @@ class OptionProcessor { const int Index() const { return index_; } private: - static blaze_exit_code::ExitCode Parse(string filename, const int index, + static blaze_exit_code::ExitCode Parse(const string& filename, + const int index, std::vector<RcFile>* rcfiles, std::map<string, std::vector<RcOption> >* rcoptions, |