Tweaks for unpacker

This commit is contained in:
gfx 2010-09-15 13:41:10 +09:00
parent 0e0a2aa981
commit 1de03fbe18

View File

@ -198,7 +198,10 @@ STATIC_INLINE int template_callback_raw(unpack_user* u PERL_UNUSED_DECL, const c
#define UNPACKER(from, name) \ #define UNPACKER(from, name) \
msgpack_unpack_t *name; \ msgpack_unpack_t *name; \
name = INT2PTR(msgpack_unpack_t*, SvROK((from)) ? SvIV(SvRV((from))) : SvIV((from))); \ if(!(SvROK(from) && SvIOK(SvRV(from)))) { \
Perl_croak(aTHX_ "Invalid unpacker instance for " #name); \
} \
name = INT2PTR(msgpack_unpack_t*, SvIVX(SvRV((from)))); \
if(name == NULL) { \ if(name == NULL) { \
Perl_croak(aTHX_ "NULL found for " # name " when shouldn't be."); \ Perl_croak(aTHX_ "NULL found for " # name " when shouldn't be."); \
} }