]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Improve Args::from_gcc_atfile
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 5 May 2020 12:55:39 +0000 (14:55 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 5 May 2020 18:25:58 +0000 (20:25 +0200)
Scanning for the null character from the string is more efficient.

src/Args.cpp

index dd4b356d9b1b44f76a4ae334cff525716d674b75..00a1e3234f26539b8e33ca4b86052e5a4f2b77de 100644 (file)
@@ -109,7 +109,7 @@ Args::from_gcc_atfile(const std::string& filename)
       // End of token
       *argpos = '\0';
       if (argbuf[0] != '\0') {
-        args.push_back(argbuf.substr(0, argbuf.find_last_not_of('\0') + 1));
+        args.push_back(argbuf.substr(0, argbuf.find('\0')));
       }
       argpos = argbuf.begin();
       if (*pos == '\0') {