From: Joel Rosdahl Date: Mon, 24 Feb 2025 19:18:35 +0000 (+0100) Subject: refactor: Simplify nested ifs X-Git-Tag: v4.11~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0f77dd64158d56fc89d0c1dcbe9a053f38e7959;p=thirdparty%2Fccache.git refactor: Simplify nested ifs --- diff --git a/src/ccache/argprocessing.cpp b/src/ccache/argprocessing.cpp index c10c0278..c2eaa6f9 100644 --- a/src/ccache/argprocessing.cpp +++ b/src/ccache/argprocessing.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2024 Joel Rosdahl and other contributors +// Copyright (C) 2020-2025 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -1191,17 +1191,16 @@ process_option_arg(const Context& ctx, // Potentially rewrite concatenated absolute path argument to relative. if (arg[0] == '-') { const auto [option, path] = util::split_option_with_concat_path(arg); - if (path) { - if (compopt_takes_concat_arg(option) && compopt_takes_path(option)) { - const auto relpath = core::make_relative_path(ctx, *path); - std::string new_option = FMT("{}{}", option, relpath); - if (compopt_affects_cpp_output(option)) { - state.cpp_args.push_back(std::move(new_option)); - } else { - state.common_args.push_back(std::move(new_option)); - } - return Statistic::none; + if (path && compopt_takes_concat_arg(option) + && compopt_takes_path(option)) { + const auto relpath = core::make_relative_path(ctx, *path); + std::string new_option = FMT("{}{}", option, relpath); + if (compopt_affects_cpp_output(option)) { + state.cpp_args.push_back(std::move(new_option)); + } else { + state.common_args.push_back(std::move(new_option)); } + return Statistic::none; } }