diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 15:45:34 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 15:45:34 +0000 |
commit | 1fa39f057d59aeee2b9f36cf3b152528a1197ae1 (patch) | |
tree | b7aa03c2bb6d8e79f636252eda7fab02b059cd14 /base/command_line.cc | |
parent | 691a97e5081651a1df05eb9a59b6ce111e949350 (diff) | |
download | chromium_src-1fa39f057d59aeee2b9f36cf3b152528a1197ae1.zip chromium_src-1fa39f057d59aeee2b9f36cf3b152528a1197ae1.tar.gz chromium_src-1fa39f057d59aeee2b9f36cf3b152528a1197ae1.tar.bz2 |
micro optimize CommandLine.GetSwitchPrefixLength
avoid searching the entire length of each switch for the -- prefix, as we know it can only exist at the start.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7866036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/command_line.cc')
-rw-r--r-- | base/command_line.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index b028226..22977af 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -37,7 +37,7 @@ const CommandLine::CharType* const kSwitchPrefixes[] = {"--", "-"}; size_t GetSwitchPrefixLength(const CommandLine::StringType& string) { for (size_t i = 0; i < arraysize(kSwitchPrefixes); ++i) { CommandLine::StringType prefix(kSwitchPrefixes[i]); - if (string.find(prefix) == 0) + if (string.compare(0, prefix.length(), prefix) == 0) return prefix.length(); } return 0; |