projects
/
platform
/
upstream
/
perl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
de64752
)
A clearer implementation of B::SV::object_2svref()
author
Nicholas Clark
<nick@ccl4.org>
Fri, 29 Oct 2010 09:59:23 +0000
(10:59 +0100)
committer
Nicholas Clark
<nick@ccl4.org>
Fri, 29 Oct 2010 09:59:23 +0000
(10:59 +0100)
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
patch
|
blob
|
history
diff --git
a/ext/B/B.xs
b/ext/B/B.xs
index 1b93e7d6056515f948dee9f71143a9d77886e203..6f1e17ec035fbc3c5715a9bdafa764b7942de519 100644
(file)
--- 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