From 9ab6168f006d383c2bcfe74d710340697c4bdbab Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Mon, 24 Sep 2018 18:50:11 +0100 Subject: [PATCH] Reduce some source line lengths. --- src/load-service.cc | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/load-service.cc b/src/load-service.cc index 6dc47d4..6bfe776 100644 --- a/src/load-service.cc +++ b/src/load-service.cc @@ -236,10 +236,12 @@ static uid_t parse_uid_param(const std::string ¶m, const std::string &servic if (pwent == nullptr) { // Maybe an error, maybe just no entry. if (errno == 0) { - throw service_description_exc(service_name, "Specified user \"" + param + "\" does not exist in system database."); + throw service_description_exc(service_name, "Specified user \"" + param + + "\" does not exist in system database."); } else { - throw service_description_exc(service_name, std::string("Error accessing user database: ") + strerror(errno)); + throw service_description_exc(service_name, std::string("Error accessing user database: ") + + strerror(errno)); } } @@ -250,7 +252,8 @@ static uid_t parse_uid_param(const std::string ¶m, const std::string &servic return pwent->pw_uid; } -static const char * num_err_msg = "Specified value contains invalid numeric characters or is outside allowed range."; +static const char * num_err_msg = "Specified value contains invalid numeric characters or is outside " + "allowed range."; // Parse an unsigned numeric parameter value static unsigned long long parse_unum_param(const std::string ¶m, const std::string &service_name, @@ -272,7 +275,8 @@ static unsigned long long parse_unum_param(const std::string ¶m, const std:: } } -static const char * gid_err_msg = "Specified group id contains invalid numeric characters or is outside allowed range."; +static const char * gid_err_msg = "Specified group id contains invalid numeric characters or is " + "outside allowed range."; static gid_t parse_gid_param(const std::string ¶m, const std::string &service_name) { @@ -287,7 +291,8 @@ static gid_t parse_gid_param(const std::string ¶m, const std::string &servic static_assert((uintmax_t)std::numeric_limits::max() <= (uintmax_t)std::numeric_limits::max(), "gid_t is too large"); unsigned long long v = std::stoull(param, &ind, 0); - if (v > static_cast(std::numeric_limits::max()) || ind != param.length()) { + if (v > static_cast(std::numeric_limits::max()) + || ind != param.length()) { throw service_description_exc(service_name, gid_err_msg); } return v; @@ -304,10 +309,12 @@ static gid_t parse_gid_param(const std::string ¶m, const std::string &servic if (grent == nullptr) { // Maybe an error, maybe just no entry. if (errno == 0) { - throw service_description_exc(service_name, "Specified group \"" + param + "\" does not exist in system database."); + throw service_description_exc(service_name, "Specified group \"" + param + + "\" does not exist in system database."); } else { - throw service_description_exc(service_name, std::string("Error accessing group database: ") + strerror(errno)); + throw service_description_exc(service_name, std::string("Error accessing group database: ") + + strerror(errno)); } } @@ -358,7 +365,8 @@ static void parse_timespec(const std::string ¶mval, const std::string &servi // line - the string storing the command and arguments // offsets - the [start,end) pair of offsets of the command and each argument within the string // -static void do_env_subst(std::string &line, std::list> &offsets, bool do_sub_vars) +static void do_env_subst(std::string &line, std::list> &offsets, + bool do_sub_vars) { if (do_sub_vars) { auto i = offsets.begin(); @@ -367,7 +375,8 @@ static void do_env_subst(std::string &line, std::list> indices; string onstart_cmds = read_setting_value(i, end, &indices); for (auto indexpair : indices) { - string option_txt = onstart_cmds.substr(indexpair.first, indexpair.second - indexpair.first); + string option_txt = onstart_cmds.substr(indexpair.first, + indexpair.second - indexpair.first); if (option_txt == "starts-rwfs") { onstart_flags.rw_ready = true; } @@ -668,7 +679,8 @@ service_record * dirload_service_set::load_service(const char * name) std::list> indices; string load_opts = read_setting_value(i, end, &indices); for (auto indexpair : indices) { - string option_txt = load_opts.substr(indexpair.first, indexpair.second - indexpair.first); + string option_txt = load_opts.substr(indexpair.first, + indexpair.second - indexpair.first); if (option_txt == "sub-vars") { // substitute environment variables in command line do_sub_vars = true; @@ -685,7 +697,8 @@ service_record * dirload_service_set::load_service(const char * name) string signame = read_setting_value(i, end, nullptr); int signo = signal_name_to_number(signame); if (signo == -1) { - throw service_description_exc(name, "Unknown/unsupported termination signal: " + signame); + throw service_description_exc(name, "Unknown/unsupported termination signal: " + + signame); } else { term_signal = signo; -- 2.25.1