]> git.vpit.fr Git - perl/modules/Sub-Op.git/blobdiff - Op.xs
Rename the "len" member of the sub_op_config_t struct to "namelen"
[perl/modules/Sub-Op.git] / Op.xs
diff --git a/Op.xs b/Op.xs
index 89716e7602a4ed44c9719441ebd3e2fb3aae26fe..634ddc873f87e8297bf1dc030b9b1a32ba3730ed 100644 (file)
--- 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);