From f7afd83ded2bb19ea2e04b55625e1076d3970a93 Mon Sep 17 00:00:00 2001 From: wlux Date: Fri, 23 Dec 2011 14:59:14 +0000 Subject: [PATCH] Correct result of NSRegularExpression -rangeOfFirstMatchInString:... When no match is found location must be set to NSNotFound. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34348 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSRegularExpression.m | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7da0c77c..d24d1c33f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-12-23 Wolfgang Lux + + * Source/NSRegularExpression.m (-rangeOfFirstMatchInString:...): + Return range (NSNotFound, 0) when no match is found. + 2011-12-22 Wolfgang Lux * Source/NSRegularExpression.m (-initWithPattern:options:error:, diff --git a/Source/NSRegularExpression.m b/Source/NSRegularExpression.m index f97893e1a..4e2519b77 100644 --- a/Source/NSRegularExpression.m +++ b/Source/NSRegularExpression.m @@ -491,7 +491,7 @@ prepareResult(NSRegularExpression *regex, options: (NSMatchingOptions)opts range: (NSRange)range { - __block NSRange r; + __block NSRange r = {NSNotFound, 0}; opts &= ~NSMatchingReportProgress; opts &= ~NSMatchingReportCompletion; @@ -623,7 +623,7 @@ prepareResult(NSRegularExpression *regex, options: (NSMatchingOptions)opts range: (NSRange)range { - NSRange result = {0,0}; + NSRange result = {NSNotFound, 0}; FAKE_BLOCK_HACK(result, {