diff options
author | nigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-02-24 21:41:21 +0000 |
---|---|---|
committer | nigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-02-24 21:41:21 +0000 |
commit | ced1f145fdf26ec7df4b9048a9da0ef17e9618f2 (patch) | |
tree | 371f88a16cfb5ac0a176622bcd424aa6c28c4cc8 /pcre_scanner.cc | |
parent | 2550303b1f255c525d802f94d9c4411a0ccc630f (diff) | |
download | pcre-ced1f145fdf26ec7df4b9048a9da0ef17e9618f2.tar.gz |
Load pcre-6.5 into code/trunk.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@87 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_scanner.cc')
-rw-r--r-- | pcre_scanner.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pcre_scanner.cc b/pcre_scanner.cc index 4a66fdf..29e0d84 100644 --- a/pcre_scanner.cc +++ b/pcre_scanner.cc @@ -30,7 +30,6 @@ // Author: Sanjay Ghemawat #include <vector> -#include <algorithm> // for count() #include <assert.h> #include "config.h" #include "pcre_scanner.h" @@ -90,7 +89,12 @@ void Scanner::EnableSkip() { int Scanner::LineNumber() const { // TODO: Make it more efficient by keeping track of the last point // where we computed line numbers and counting newlines since then. - return 1 + std::count(data_.data(), input_.data(), '\n'); + // We could use std:count, but not all systems have it. :-( + int count = 1; + for (const char* p = data_.data(); p < input_.data(); ++p) + if (*p == '\n') + ++count; + return count; } int Scanner::Offset() const { |