Move more string_util functions to base namespace. Rename IsWhitespace to IsUnicodeWhitespace (to contrast it to the already-existing IsAsciiWhitespace). De-inline HexDigitToInt. This is only used in a few places and I don't think it's necessary to inline. Remove some redundant base:: qualifications in base. TBR=sky Review URL: https://codereview.chromium.org/1200053004 Cr-Original-Commit-Position: refs/heads/master@{#335827} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: b3413064f36bf166d7dffb463bc442059dab1dd7
diff --git a/tools/gn/command_args.cc b/tools/gn/command_args.cc index c4c16bb..518a1b6 100644 --- a/tools/gn/command_args.cc +++ b/tools/gn/command_args.cc
@@ -37,7 +37,7 @@ bool DoesLineBeginWithComment(const base::StringPiece& line) { // Skip whitespace. size_t i = 0; - while (i < line.size() && IsAsciiWhitespace(line[i])) + while (i < line.size() && base::IsAsciiWhitespace(line[i])) i++; return i < line.size() && line[i] == '#';
diff --git a/tools/gn/filesystem_utils.cc b/tools/gn/filesystem_utils.cc index 67bb6e2..6e1c01d 100644 --- a/tools/gn/filesystem_utils.cc +++ b/tools/gn/filesystem_utils.cc
@@ -100,7 +100,7 @@ return false; // Check drive letter. - if (!IsAsciiAlpha(path[0])) + if (!base::IsAsciiAlpha(path[0])) return false; if (!IsSlash(path[2]))
diff --git a/tools/gn/label.cc b/tools/gn/label.cc index 60ebf31..171511a 100644 --- a/tools/gn/label.cc +++ b/tools/gn/label.cc
@@ -105,7 +105,7 @@ return false; } if (input.size() > 3 && input[2] == ':' && IsSlash(input[3]) && - IsAsciiAlpha(input[1])) { + base::IsAsciiAlpha(input[1])) { // Skip over the drive letter colon. offset = 3; }
diff --git a/tools/gn/label_pattern.cc b/tools/gn/label_pattern.cc index e5ea5cf..6c8addd 100644 --- a/tools/gn/label_pattern.cc +++ b/tools/gn/label_pattern.cc
@@ -132,7 +132,7 @@ return LabelPattern(); } if (str.size() > 3 && str[2] == ':' && IsSlash(str[3]) && - IsAsciiAlpha(str[1])) { + base::IsAsciiAlpha(str[1])) { // Skip over the drive letter colon. offset = 3; }
diff --git a/tools/gn/tokenizer.cc b/tools/gn/tokenizer.cc index 567fa72..be3223b 100644 --- a/tools/gn/tokenizer.cc +++ b/tools/gn/tokenizer.cc
@@ -188,7 +188,7 @@ Token::Type Tokenizer::ClassifyCurrent() const { DCHECK(!at_end()); char next_char = cur_char(); - if (IsAsciiDigit(next_char)) + if (base::IsAsciiDigit(next_char)) return Token::INTEGER; if (next_char == '"') return Token::STRING; @@ -228,7 +228,7 @@ return Token::UNCLASSIFIED_OPERATOR; // Just the minus before end of // file. char following_char = input_[cur_ + 1]; - if (IsAsciiDigit(following_char)) + if (base::IsAsciiDigit(following_char)) return Token::INTEGER; return Token::UNCLASSIFIED_OPERATOR; } @@ -242,7 +242,7 @@ case Token::INTEGER: do { Advance(); - } while (!at_end() && IsAsciiDigit(cur_char())); + } while (!at_end() && base::IsAsciiDigit(cur_char())); if (!at_end()) { // Require the char after a number to be some kind of space, scope, // or operator.
diff --git a/tools/gn/tokenizer.h b/tools/gn/tokenizer.h index 497a170..29d107a 100644 --- a/tools/gn/tokenizer.h +++ b/tools/gn/tokenizer.h
@@ -33,12 +33,12 @@ static bool IsNewline(const base::StringPiece& buffer, size_t offset); static bool IsIdentifierFirstChar(char c) { - return IsAsciiAlpha(c) || c == '_'; + return base::IsAsciiAlpha(c) || c == '_'; } static bool IsIdentifierContinuingChar(char c) { // Also allow digits after the first char. - return IsIdentifierFirstChar(c) || IsAsciiDigit(c); + return IsIdentifierFirstChar(c) || base::IsAsciiDigit(c); } private: