summaryrefslogtreecommitdiffstats
path: root/src/depfile_parser.in.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.in.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.in.cc')
-rw-r--r--src/depfile_parser.in.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/depfile_parser.in.cc b/src/depfile_parser.in.cc
index 4699e8f..7ac95c6 100644
--- a/src/depfile_parser.in.cc
+++ b/src/depfile_parser.in.cc
@@ -26,16 +26,15 @@
// 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;
/*!re2c
- re2c:define:YYCTYPE = "const char";
+ re2c:define:YYCTYPE = "char";
re2c:define:YYCURSOR = p;
- re2c:define:YYMARKER = q;
re2c:define:YYLIMIT = end;
re2c:yyfill:parameter = 0;
@@ -50,7 +49,7 @@ bool DepfileParser::Parse(const string& content, string* err) {
[ \n]+ { continue; }
[a-zA-Z0-9+,/\\_:.-]+ {
// Got a filename.
- int len = p - start;;
+ int len = p - start;
if (start[len - 1] == ':')
len--; // Strip off trailing colon, if any.