From 5bdac96375f0cc5b75313cc3a9a7bbeb21594a0b Mon Sep 17 00:00:00 2001 From: gfx Date: Wed, 15 Sep 2010 14:18:38 +0900 Subject: [PATCH] The object root can be NULL --- perl/xs-src/unpack.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/perl/xs-src/unpack.c b/perl/xs-src/unpack.c index 9500212c..dce6782c 100644 --- a/perl/xs-src/unpack.c +++ b/perl/xs-src/unpack.c @@ -50,8 +50,7 @@ static int template_execute(msgpack_unpack_t* u PERL_UNUSED_DECL, STATIC_INLINE SV* template_callback_root(unpack_user* u PERL_UNUSED_DECL) { - dTHX; - return &PL_sv_undef; + return NULL; } STATIC_INLINE int template_callback_uint8(unpack_user* u PERL_UNUSED_DECL, uint8_t d, SV** o) @@ -310,7 +309,7 @@ STATIC_INLINE SV* _execute_impl(SV* self, SV* data, UV off, size_t limit) { XS(xs_unpacker_execute) { dXSARGS; if (items != 3) { - Perl_croak(aTHX_ "Usage: $unpacker->execute_limit(data, off)"); + Perl_croak(aTHX_ "Usage: $unpacker->execute(data, off)"); } UNPACKER(ST(0), mp); @@ -398,8 +397,8 @@ XS(xs_unpacker_destroy) { } UNPACKER(ST(0), mp); - SV * data = template_data(mp); - if (SvOK(data)) { + SV* const data = template_data(mp); + if (data) { SvREFCNT_dec(data); } Safefree(mp);