diff --git a/build/whitespace.txt b/build/whitespace.txt deleted file mode 100644 index cc88ce55..00000000 --- a/build/whitespace.txt +++ /dev/null @@ -1 +0,0 @@ -This is a whitespace file used to kick off jobs. diff --git a/client/client_argv_handling.cc b/client/client_argv_handling.cc index 9b813b1c..6933aac6 100644 --- a/client/client_argv_handling.cc +++ b/client/client_argv_handling.cc @@ -27,38 +27,38 @@ std::string FormatArgumentString(const std::string& name, } // namespace -void BuildHandlerArgvStrings( +std::vector BuildHandlerArgvStrings( const base::FilePath& handler, const base::FilePath& database, const base::FilePath& metrics_dir, const std::string& url, const std::map& annotations, - const std::vector& arguments, - std::vector* argv_strings) { - argv_strings->clear(); + const std::vector& arguments) { + std::vector argv_strings(1, handler.value()); - argv_strings->push_back(handler.value()); for (const auto& argument : arguments) { - argv_strings->push_back(argument); + argv_strings.push_back(argument); } if (!database.empty()) { - argv_strings->push_back(FormatArgumentString("database", database.value())); + argv_strings.push_back(FormatArgumentString("database", database.value())); } if (!metrics_dir.empty()) { - argv_strings->push_back( + argv_strings.push_back( FormatArgumentString("metrics-dir", metrics_dir.value())); } if (!url.empty()) { - argv_strings->push_back(FormatArgumentString("url", url)); + argv_strings.push_back(FormatArgumentString("url", url)); } for (const auto& kv : annotations) { - argv_strings->push_back( + argv_strings.push_back( FormatArgumentString("annotation", kv.first + '=' + kv.second)); } + + return argv_strings; } void ConvertArgvStrings(const std::vector& argv_strings, diff --git a/client/client_argv_handling.h b/client/client_argv_handling.h index 0ef3a154..d380b1a0 100644 --- a/client/client_argv_handling.h +++ b/client/client_argv_handling.h @@ -28,16 +28,14 @@ namespace crashpad { //! //! See StartHandlerAtCrash() for documentation on the input arguments. //! -//! \param[out] A argv_strings vector of arguments suitable for starting the -//! handler with. -void BuildHandlerArgvStrings( +//! \return A vector of arguments suitable for starting the handler with. +std::vector BuildHandlerArgvStrings( const base::FilePath& handler, const base::FilePath& database, const base::FilePath& metrics_dir, const std::string& url, const std::map& annotations, - const std::vector& arguments, - std::vector* argv_strings); + const std::vector& arguments); //! \brief Flattens a string vector into a const char* vector suitable for use //! in an exec() call. diff --git a/client/crashpad_client_fuchsia.cc b/client/crashpad_client_fuchsia.cc index 26781094..0d1b65bf 100644 --- a/client/crashpad_client_fuchsia.cc +++ b/client/crashpad_client_fuchsia.cc @@ -58,14 +58,8 @@ bool CrashpadClient::StartHandler( return false; } - std::vector argv_strings; - BuildHandlerArgvStrings(handler, - database, - metrics_dir, - url, - annotations, - arguments, - &argv_strings); + std::vector argv_strings = BuildHandlerArgvStrings( + handler, database, metrics_dir, url, annotations, arguments); std::vector argv; ConvertArgvStrings(argv_strings, &argv); diff --git a/client/crashpad_client_linux.cc b/client/crashpad_client_linux.cc index e7fa162c..54fe268a 100644 --- a/client/crashpad_client_linux.cc +++ b/client/crashpad_client_linux.cc @@ -175,9 +175,8 @@ bool CrashpadClient::StartHandlerAtCrash( const std::string& url, const std::map& annotations, const std::vector& arguments) { - std::vector argv; - BuildHandlerArgvStrings( - handler, database, metrics_dir, url, annotations, arguments, &argv); + std::vector argv = BuildHandlerArgvStrings( + handler, database, metrics_dir, url, annotations, arguments); auto signal_handler = LaunchAtCrashHandler::Get(); if (signal_handler->Initialize(&argv)) { @@ -197,9 +196,8 @@ bool CrashpadClient::StartHandlerForClient( const std::map& annotations, const std::vector& arguments, int socket) { - std::vector argv; - BuildHandlerArgvStrings( - handler, database, metrics_dir, url, annotations, arguments, &argv); + std::vector argv = BuildHandlerArgvStrings( + handler, database, metrics_dir, url, annotations, arguments); argv.push_back(FormatArgumentInt("initial-client", socket));