perl: make error messages compatible with XS

This commit is contained in:
Fuji, Goro 2010-10-30 00:28:53 +09:00
parent c320e44a23
commit f1c294ca50

View File

@ -305,10 +305,10 @@ foreach my $pair(
sub _unpack {
my ( $value ) = @_;
# get a header byte
my $byte = unpack "x$p C", $value; # "x$p" is faster than substr()
defined(my $byte = unpack "x$p C", $value)
or Carp::confess("Data::MessagePack->unpack: insufficient bytes");
$p++;
Carp::croak("invalid data") unless defined $byte;
# +/- fixnum, nil, true, false
return $byte2value[$byte] if $typemap[$byte] & $T_DIRECT;