Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regex callback #476

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Source/NSRegularExpression.m
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,20 @@ - (NSUInteger) hash
callback(const void *context, int32_t steps)
{
BOOL stop = NO;
BOOL keepGoing = YES;
GSRegexBlock block = (GSRegexBlock)context;

if (NULL == context)
{
return FALSE;
return TRUE; // keep going if there is no callback block
}
CALL_BLOCK(block, nil, NSMatchingProgress, &stop);
return stop;
keepGoing = !stop; // keep going if callback block didn't request a stop
return keepGoing;
}



#define DEFAULT_WORK_LIMIT 1500
/**
* The work limit specifies the number of iterations the matcher will do before
Expand Down
2 changes: 2 additions & 0 deletions Tests/base/NSRegularExpression/GNUmakefile.preamble
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

ADDITIONAL_OBJCFLAGS += -fblocks
Loading
Loading