diff options
Diffstat (limited to 'ext/Safe/Safe.xs')
-rw-r--r-- | ext/Safe/Safe.xs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/ext/Safe/Safe.xs b/ext/Safe/Safe.xs index ec7abce67a..8296262dd7 100644 --- a/ext/Safe/Safe.xs +++ b/ext/Safe/Safe.xs @@ -92,6 +92,18 @@ opname(...) } void +opdesc(...) + PPCODE: + int i, myopcode; + for (i = 0; i < items; i++) + { + myopcode = SvIV(ST(i)); + if (myopcode < 0 || myopcode >= maxo) + croak("opcode out of range"); + XPUSHs(sv_2mortal(newSVpv(op_desc[myopcode], 0))); + } + +void opcode(...) PPCODE: int i, j; @@ -99,7 +111,10 @@ opcode(...) for (i = 0; i < items; i++) { op = SvPV(ST(i), na); - for (j = 0; j < maxo && strNE(op, op_name[j]); j++) /* nothing */ ; + for (j = 0; j < maxo; j++) { + if (strEQ(op, op_name[j]) || strEQ(op, op_desc[j])) + break; + } if (j == maxo) croak("bad op name \"%s\"", op); XPUSHs(sv_2mortal(newSViv(j))); |