Skip to content

Commit c857378

Browse files
committed
Revert "Explicitly reject length(NAME) with typemaps other than T_PV"
This reverts commit a129015.
1 parent 5ea209f commit c857378

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,9 +1412,7 @@ sub lookup_input_typemap {
14121412
# as a pseudo-parameter, then override the normal typedef - which
14131413
# would emit SvPV_nolen(...) - and instead, emit SvPV(...,
14141414
# STRLEN_length_of_foo)
1415-
if ($self->{has_length}) {
1416-
die "length(NAME) not supported with typemaps other than T_PV"
1417-
if $xstype ne 'T_PV';
1415+
if ($xstype eq 'T_PV' and $self->{has_length}) {
14181416
die "default value not supported with length(NAME) supplied"
14191417
if defined $default;
14201418
return "($type)SvPV($arg, STRLEN_length_of_$var);",

dist/ExtUtils-ParseXS/t/001-basic.t

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ EOF
967967
|
968968
|int
969969
|foo( a , char * b , OUT int c , OUTLIST int d , \
970-
| IN_OUT char * * e = 1 + 2 , long length(b) , \
970+
| IN_OUT char * * e = 1 + 2 , long length(e) , \
971971
| char* f="abc" , g = 0 , ... )
972972
EOF
973973

@@ -1607,13 +1607,6 @@ EOF
16071607
[ 1, 0, qr{\QError: length() on non-parameter 's'\E.*line 6},
16081608
"got expected error" ],
16091609
],
1610-
1611-
[
1612-
'length of int is invalid',
1613-
['int', 'foo(int a, size_t length(a))'],
1614-
[ 1, 0 , qr/length\(NAME\) not supported with typemaps other than T_PV/, 'Got expected error about length' ],
1615-
],
1616-
16171610
);
16181611
16191612
test_many($preamble, 'XS_Foo_', \@test_fns);

0 commit comments

Comments
 (0)