From 9efba5c8ba482f48d0d42ef3b332f7217f2b0e1e Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Fri, 29 Oct 2010 10:59:23 +0100 Subject: [PATCH] A clearer implementation of B::SV::object_2svref() The same number of lines of code, but it avoids using 2 #defines simply to take advantage of typemap entries, which the reader may not be familiar with. --- ext/B/B.xs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/B/B.xs b/ext/B/B.xs index 1b93e7d..6f1e17e 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -1293,13 +1293,13 @@ REFCNT(sv) OUTPUT: RETVAL -#define object_2svref(sv) sv -#define SVREF SV * - -SVREF +void object_2svref(sv) B::SV sv - + PPCODE: + ST(0) = sv_2mortal(newRV(sv)); + XSRETURN(1); + MODULE = B PACKAGE = B::IV PREFIX = Sv IV -- 2.7.4