… | |
… | |
808 | |
808 | |
809 | #define SvPTR(var, arg, type, class, nullok) \ |
809 | #define SvPTR(var, arg, type, class, nullok) \ |
810 | if (!SvOK (arg)) \ |
810 | if (!SvOK (arg)) \ |
811 | { \ |
811 | { \ |
812 | if (!nullok) \ |
812 | if (!nullok) \ |
813 | Perl_croak (# var " must be a " # class " object, not undef"); \ |
813 | croak (# var " must be a " # class " object, not undef"); \ |
814 | \ |
814 | \ |
815 | (var) = 0; \ |
815 | (var) = 0; \ |
816 | } \ |
816 | } \ |
817 | else if (sv_derived_from ((arg), # class)) \ |
817 | else if (sv_derived_from ((arg), # class)) \ |
818 | { \ |
818 | { \ |
819 | IV tmp = SvIV ((SV*) SvRV (arg)); \ |
819 | IV tmp = SvIV ((SV*) SvRV (arg)); \ |
820 | (var) = INT2PTR (type, tmp); \ |
820 | (var) = INT2PTR (type, tmp); \ |
821 | if (!var) \ |
821 | if (!var) \ |
822 | Perl_croak (# var " is not a valid " # class " object anymore"); \ |
822 | croak (# var " is not a valid " # class " object anymore"); \ |
823 | } \ |
823 | } \ |
824 | else \ |
824 | else \ |
825 | Perl_croak (# var " is not of type " # class); \ |
825 | croak (# var " is not of type " # class); \ |
826 | \ |
826 | \ |
827 | |
827 | |
828 | static void |
828 | static void |
829 | ptr_nuke (SV *sv) |
829 | ptr_nuke (SV *sv) |
830 | { |
830 | { |