summaryrefslogtreecommitdiffstats
path: root/src/depfile_parser.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-12-27 21:48:17 (GMT)
committerEvan Martin <martine@danga.com>2011-12-27 21:48:17 (GMT)
commitfe7e51531e5df3149538007c40b8d115ceebb805 (patch)
treeb6e7e4f0499b3a3b3acdfaaa8d1cb624d1b73bf9 /src/depfile_parser.cc
parent51709668ab2d7d701b415a1a85cfc66c83db4510 (diff)
downloadNinja-fe7e51531e5df3149538007c40b8d115ceebb805.zip
Ninja-fe7e51531e5df3149538007c40b8d115ceebb805.tar.gz
Ninja-fe7e51531e5df3149538007c40b8d115ceebb805.tar.bz2
switch DepfileParser to take a string* to make memory clearer
Add some comments as well.
Diffstat (limited to 'src/depfile_parser.cc')
-rw-r--r--src/depfile_parser.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/depfile_parser.cc b/src/depfile_parser.cc
index 5e718d9..b547661 100644
--- a/src/depfile_parser.cc
+++ b/src/depfile_parser.cc
@@ -27,9 +27,9 @@
// Rather than implement the above, we do the simpler thing here.
// If anyone actually has depfiles that rely on the more complicated
// behavior we can adjust this.
-bool DepfileParser::Parse(const string& content, string* err) {
- const char* p = content.data();
- const char* end = content.data() + content.size();
+bool DepfileParser::Parse(string* content, string* err) {
+ char* p = &(*content)[0];
+ char* end = p + content->size();
for (;;) {
const char* start = p;
char yych;
@@ -98,7 +98,7 @@ bool DepfileParser::Parse(const string& content, string* err) {
yy3:
{
// Got a filename.
- int len = p - start;;
+ int len = p - start;
if (start[len - 1] == ':')
len--; // Strip off trailing colon, if any.