Skip to content
Merged
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
2 changes: 1 addition & 1 deletion embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,7 @@ Adhp |REGEXP *|pregcomp |NN SV * const pattern \
|const U32 flags
Adhp |I32 |pregexec |NN REGEXP * const prog \
|MPTR char *stringarg \
|EPTR char *strend \
|EPTRQ char *strend \
|SPTR char *strbeg \
|SSize_t minend \
|NN SV *screamer \
Expand Down
2 changes: 1 addition & 1 deletion ext/XS-APItest/APItest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;
use Carp;

our $VERSION = '1.47';
our $VERSION = '1.48';

require XSLoader;

Expand Down
23 changes: 23 additions & 0 deletions ext/XS-APItest/APItest.xs
Original file line number Diff line number Diff line change
Expand Up @@ -4780,6 +4780,29 @@ CODE:
OUTPUT:
RETVAL

# provide access to pregexec, except replace pointers within the
# string with offsets from the start of the string

I32
callpregexec(SV *prog, STRLEN stringarg, STRLEN strend, I32 minend, SV *sv, U32 nosave)
CODE:
{
STRLEN len;
char *strbeg;
if (SvROK(prog))
prog = SvRV(prog);
strbeg = SvPV_force(sv, len);
RETVAL = pregexec((REGEXP *)prog,
strbeg + stringarg,
strbeg + strend,
strbeg,
minend,
sv,
nosave);
}
OUTPUT:
RETVAL

void
lexical_import(SV *name, CV *cv)
CODE:
Expand Down
7 changes: 5 additions & 2 deletions ext/XS-APItest/t/callregexec.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!perl

# test CALLREGEXEC()
# test CALLREGEXEC() and pregexec()
# (currently it just checks that it handles non-\0 terminated strings;
# full tests haven't been added yet)

Expand All @@ -10,7 +10,7 @@ use strict;
use XS::APItest;
*callregexec = *XS::APItest::callregexec;

use Test::More tests => 48;
use Test::More tests => 75;

# Test that the regex engine can handle strings without terminating \0
# XXX This is by no means comprehensive; it doesn't test all ops, nor all
Expand All @@ -34,6 +34,8 @@ sub try {
my $bytes = do { use bytes; length $str1 };
ok !!$exp == !!callregexec($re, 0, $bytes, 0, $str, 0),
"$desc callregexec";
ok !!$exp == !!callpregexec($re, 0, $bytes, 0, $str, 0),
"$desc callpregexec";
}


Expand Down Expand Up @@ -62,4 +64,5 @@ sub try {
try "ab\t", qr/^.+\h/, 0, 'HORIZWS';
try "abx", qr/^.+\H/, 1, 'NHORIZWS';
try "abx", qr/a.*x/, 0, 'CURLY';
try "", qr/x?/, 1, 'empty';
}
2 changes: 1 addition & 1 deletion proto.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading