CODE:
STRLEN len;
U32 hash = 0;
- const char *s = SvPV(sv, len);
+ const char *s = SvPVbyte(sv, len);
PERL_HASH(hash, s, len);
ST(0) = sv_2mortal(Perl_newSVpvf(aTHX_ "0x%"UVxf, (UV)hash));
like(B::hash("\0" x $_), qr/\A0x0+\z/, "Testing B::hash(\"0\" x $_)")
for 0..19;
+
+ $hash = eval {B::hash(chr 256)};
+ is($hash, undef, "B::hash() refuses non-octets");
+ like($@, qr/^Wide character in subroutine entry/);
+
+ $hash = B::hash(chr 163);
+ my $str = chr(163) . chr 256;
+ chop $str;
+ is(B::hash($str), $hash, 'B::hash() with chr 128-256 is well-behaved');
}
{
is(B::cstring(undef), '0', "Testing B::cstring(undef)");