From: Thomas Otto Date: Tue, 3 Mar 2020 22:24:54 +0000 (+0100) Subject: Adapt dependencies_env processing to use split_into_views() X-Git-Tag: v4.0~547^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30fc25e6ed548b169596e1d0872ad4b6faaf5bba;p=thirdparty%2Fccache.git Adapt dependencies_env processing to use split_into_views() --- diff --git a/src/ccache.cpp b/src/ccache.cpp index 228b4894a..f93bc2f15 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -2926,15 +2926,18 @@ process_args(Context& ctx, if (dependencies_env) { args_info.generating_dependencies = true; dependency_filename_specified = true; - char* saveptr = nullptr; - char* abspath_file = strtok_r(dependencies_env, " ", &saveptr); - args_info.output_dep = make_relative_path(ctx, abspath_file); + auto dependencies = Util::split_into_views(dependencies_env, " "); + + if (dependencies.size() > 0) { + auto abspath_file = dependencies.at(0); + args_info.output_dep = make_relative_path(ctx, abspath_file); + } // specifying target object is optional. - char* abspath_obj = strtok_r(nullptr, " ", &saveptr); - if (abspath_obj) { + if (dependencies.size() > 1) { // it's the "file target" form. + string_view abspath_obj = dependencies.at(1); dependency_target_specified = true; std::string relpath_obj = make_relative_path(ctx, abspath_obj);