This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge the XS implementation of B::OP::name and B::OP::desc
authorNicholas Clark <nick@ccl4.org>
Thu, 28 Oct 2010 12:17:06 +0000 (13:17 +0100)
committerNicholas Clark <nick@ccl4.org>
Thu, 28 Oct 2010 12:17:06 +0000 (13:17 +0100)
This saves 4 lines of source code, but over 1K of object code.

ext/B/B.xs

index 95d76fc..0143487 100644 (file)
@@ -833,7 +833,6 @@ threadsv_names()
 
 #define OP_next(o)     o->op_next
 #define OP_sibling(o)  o->op_sibling
-#define OP_desc(o)     (char *)PL_op_desc[o->op_type]
 #define OP_targ(o)     o->op_targ
 #define OP_flags(o)    o->op_flags
 #define OP_private(o)  o->op_private
@@ -859,12 +858,13 @@ OP_sibling(o)
 char *
 OP_name(o)
        B::OP           o
+    ALIAS:
+       desc = 1
     CODE:
-       RETVAL = (char *)PL_op_name[o->op_type];
+       RETVAL = (char *)(ix ? PL_op_desc : PL_op_name)[o->op_type];
     OUTPUT:
        RETVAL
 
-
 void
 OP_ppaddr(o)
        B::OP           o
@@ -878,10 +878,6 @@ OP_ppaddr(o)
        sv_catpvs(sv, "]");
        ST(0) = sv;
 
-char *
-OP_desc(o)
-       B::OP           o
-
 PADOFFSET
 OP_targ(o)
        B::OP           o