81e3bd9b4b
from author via segv in PR 32155. patch-ae: from martin@, fixes recursion self-test (not installed).
26 lines
838 B
Text
26 lines
838 B
Text
$NetBSD: patch-ac,v 1.1 2005/11/24 19:34:01 wiz Exp $
|
|
|
|
--- pcre_scanner.cc.orig 2005-09-12 10:45:39.000000000 +0200
|
|
+++ 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 (HPUX). :-(
|
|
+ int count = 1;
|
|
+ for (const char* p = data_.data(); p < input_.data(); ++p)
|
|
+ if (*p == '\n')
|
|
+ ++count;
|
|
+ return count;
|
|
}
|
|
|
|
int Scanner::Offset() const {
|