]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Adapt dependencies_env processing to use split_into_views()
authorThomas Otto <thomas.otto@pdv-fs.de>
Tue, 3 Mar 2020 22:24:54 +0000 (23:24 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 16 Apr 2020 20:33:39 +0000 (22:33 +0200)
src/ccache.cpp

index 228b4894a97d15c174f81bd7ea6ebf5682d3f8ba..f93bc2f15ec43fcfb7bf279493ee8bad829f7731 100644 (file)
@@ -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);