X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Op.xs;h=634ddc873f87e8297bf1dc030b9b1a32ba3730ed;hb=50984c4a3e39b187b5b52ceeba826bc819d23564;hp=89716e7602a4ed44c9719441ebd3e2fb3aae26fe;hpb=c4608b58e39347084b651ee4c3db26bf522378ea;p=perl%2Fmodules%2FSub-Op.git diff --git a/Op.xs b/Op.xs index 89716e7..634ddc8 100644 --- a/Op.xs +++ b/Op.xs @@ -118,11 +118,11 @@ void sub_op_register(pTHX_ const sub_op_config_t *c) { if (!PL_custom_op_names) PL_custom_op_names = newHV(); - (void) hv_store_ent(PL_custom_op_names, key, newSVpv(c->name, c->len), 0); + (void) hv_store_ent(PL_custom_op_names, key, newSVpv(c->name, c->namelen), 0); if (!PL_custom_op_descs) PL_custom_op_descs = newHV(); - (void) hv_store_ent(PL_custom_op_descs, key, newSVpv(c->name, c->len), 0); + (void) hv_store_ent(PL_custom_op_descs, key, newSVpv(c->name, c->namelen), 0); if (c->check) { SV *check = newSViv(PTR2IV(c->check)); @@ -132,7 +132,7 @@ void sub_op_register(pTHX_ const sub_op_config_t *c) { { dMY_CXT; - (void) hv_store(MY_CXT.map, c->name, c->len, key, 0); + (void) hv_store(MY_CXT.map, c->name, c->namelen, key, 0); } } @@ -381,3 +381,15 @@ PPCODE: XSRETURN_UNDEF; ST(0) = sv_2mortal(newSVpvn(&on->buf, on->len)); XSRETURN(1); + +void +_constant_sub(SV *sv) +PROTOTYPE: $ +PPCODE: + if (!SvROK(sv)) + XSRETURN_UNDEF; + sv = SvRV(sv); + if (SvTYPE(sv) < SVt_PVCV) + XSRETURN_UNDEF; + ST(0) = sv_2mortal(newSVuv(CvCONST(sv))); + XSRETURN(1);