From d16e229f476195298d92bc3f9665ff4d248efd31 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 6 Jun 2007 12:03:32 +0000 Subject: [PATCH] 2007-06-06 14:02 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/hbregex.c ! added workaround for some wrong hack (to check if both can be safely removed) --- harbour/ChangeLog | 5 +++++ harbour/source/rtl/hbregex.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ffe58702b6..f9b5129686 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-06-06 14:02 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rtl/hbregex.c + ! added workaround for some wrong hack (to check if both can be + safely removed) + 2007-06-06 12:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapicls.h * changed extern hb_bProfiler to local HVM static variable diff --git a/harbour/source/rtl/hbregex.c b/harbour/source/rtl/hbregex.c index c36b16636f..39107493f3 100644 --- a/harbour/source/rtl/hbregex.c +++ b/harbour/source/rtl/hbregex.c @@ -104,13 +104,22 @@ static int hb_regexec( PHB_REGEX pRegEx, const char * szString, ULONG ulLen, int iMatches, HB_REGMATCH * aMatches ) { #if defined( HB_PCRE_REGEX ) - int iResult; + int iResult, i; + + for( i = 0; i < iMatches; i++ ) + HB_REGMATCH_EO( aMatches, i ) = -1; iResult = pcre_exec( pRegEx->re_pcre, NULL /* pcre_extra */, szString, ulLen, 0 /* startoffset */, pRegEx->iEFlags, aMatches, iMatches + 1 ); if( iResult == 0 ) - iResult = iMatches; + { + for( i = 0; i < iMatches; i++ ) + { + if( HB_REGMATCH_EO( aMatches, i ) != -1 ) + iResult = i + 1; + } + } return iResult; #elif defined( HB_POSIX_REGEX ) char * szBuffer = NULL;