diff options
author | Nico Weber <nicolasweber@gmx.de> | 2018-04-06 16:58:01 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2018-04-06 16:58:01 (GMT) |
commit | 265a6eaf399778c746c7d2c02b8742f3c0ff07e9 (patch) | |
tree | aac459a78da6b3df9486ebd3a091a82c3366b50b | |
parent | 660d628da83a6785a93f7096aaf985b534f4040d (diff) | |
download | Ninja-265a6eaf399778c746c7d2c02b8742f3c0ff07e9.zip Ninja-265a6eaf399778c746c7d2c02b8742f3c0ff07e9.tar.gz Ninja-265a6eaf399778c746c7d2c02b8742f3c0ff07e9.tar.bz2 |
rename a variable
-rw-r--r-- | src/lexer.cc | 10 | ||||
-rw-r--r-- | src/lexer.in.cc | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/lexer.cc b/src/lexer.cc index 49c69aa..3c6e70e 100644 --- a/src/lexer.cc +++ b/src/lexer.cc @@ -23,14 +23,14 @@ bool Lexer::Error(const string& message, string* err) { // Compute line/column. int line = 1; - const char* context = input_.str_; + const char* line_start = input_.str_; for (const char* p = input_.str_; p < last_token_; ++p) { if (*p == '\n') { ++line; - context = p + 1; + line_start = p + 1; } } - int col = last_token_ ? (int)(last_token_ - context) : 0; + int col = last_token_ ? (int)(last_token_ - line_start) : 0; char buf[1024]; snprintf(buf, sizeof(buf), "%s:%d: ", filename_.AsString().c_str(), line); @@ -43,12 +43,12 @@ bool Lexer::Error(const string& message, string* err) { int len; bool truncated = true; for (len = 0; len < kTruncateColumn; ++len) { - if (context[len] == 0 || context[len] == '\n') { + if (line_start[len] == 0 || line_start[len] == '\n') { truncated = false; break; } } - *err += string(context, len); + *err += string(line_start, len); if (truncated) *err += "..."; *err += "\n"; diff --git a/src/lexer.in.cc b/src/lexer.in.cc index 20ed442..c1fb822 100644 --- a/src/lexer.in.cc +++ b/src/lexer.in.cc @@ -22,14 +22,14 @@ bool Lexer::Error(const string& message, string* err) { // Compute line/column. int line = 1; - const char* context = input_.str_; + const char* line_start = input_.str_; for (const char* p = input_.str_; p < last_token_; ++p) { if (*p == '\n') { ++line; - context = p + 1; + line_start = p + 1; } } - int col = last_token_ ? (int)(last_token_ - context) : 0; + int col = last_token_ ? (int)(last_token_ - line_start) : 0; char buf[1024]; snprintf(buf, sizeof(buf), "%s:%d: ", filename_.AsString().c_str(), line); @@ -42,12 +42,12 @@ bool Lexer::Error(const string& message, string* err) { int len; bool truncated = true; for (len = 0; len < kTruncateColumn; ++len) { - if (context[len] == 0 || context[len] == '\n') { + if (line_start[len] == 0 || line_start[len] == '\n') { truncated = false; break; } } - *err += string(context, len); + *err += string(line_start, len); if (truncated) *err += "..."; *err += "\n"; |