]> git.vpit.fr Git - perl/modules/indirect.git/blobdiff - indirect.xs
Rename 'id' to 'hint' for consistency
[perl/modules/indirect.git] / indirect.xs
index b248a19ae64d16867ece884615a2873c7e2b8a8f..206a991d4ac1039366952f709cb010f66256303e 100644 (file)
 # define sv_catpvn_nomg sv_catpvn
 #endif
 
+#ifndef mPUSHu
+# define mPUSHu(U) PUSHs(sv_2mortal(newSVuv(U)))
+#endif
+
 #ifndef HvNAME_get
 # define HvNAME_get(H) HvNAME(H)
 #endif
@@ -182,7 +186,6 @@ STATIC void indirect_thread_cleanup(pTHX_ void *);
 
 STATIC void indirect_thread_cleanup(pTHX_ void *ud) {
  int *level = ud;
- SV  *id;
 
  if (*level) {
   *level = 0;
@@ -251,21 +254,21 @@ STATIC U32 indirect_hash = 0;
 
 STATIC SV *indirect_hint(pTHX) {
 #define indirect_hint() indirect_hint(aTHX)
- SV *id;
-#if I_HAS_PERL(5, 10, 0)
id = Perl_refcounted_he_fetch(aTHX_ PL_curcop->cop_hints_hash,
-                                     NULL,
-                                     __PACKAGE__, __PACKAGE_LEN__,
-                                     0,
-                                     indirect_hash);
+ SV *hint;
+#if I_HAS_PERL(5, 9, 5)
hint = Perl_refcounted_he_fetch(aTHX_ PL_curcop->cop_hints_hash,
+                                       NULL,
+                                       __PACKAGE__, __PACKAGE_LEN__,
+                                       0,
+                                       indirect_hash);
 #else
  SV **val = hv_fetch(GvHV(PL_hintgv), __PACKAGE__, __PACKAGE_LEN__,
                                                                  indirect_hash);
  if (!val)
   return 0;
id = *val;
hint = *val;
 #endif
- return (id && SvOK(id)) ? id : NULL;
+ return (hint && SvOK(hint)) ? hint : NULL;
 }
 
 /* ... op -> source position ............................................... */
@@ -512,16 +515,30 @@ STATIC OP *indirect_ck_entersub(pTHX_ OP *o) {
   if (mpos < opos) {
    SV *code = indirect_detag(hint);
 
-   if (hint) {
+   if (code) {
+    SV     *file;
+    line_t  line;
     dSP;
 
     ENTER;
     SAVETMPS;
 
+    onamesv = sv_mortalcopy(onamesv);
+    mnamesv = sv_mortalcopy(mnamesv);
+
+#ifdef USE_ITHREADS
+    file = sv_2mortal(newSVpv(CopFILE(&PL_compiling), 0));
+#else
+    file = sv_mortalcopy(CopFILESV(&PL_compiling));
+#endif
+    line = CopLINE(&PL_compiling);
+
     PUSHMARK(SP);
-    EXTEND(SP, 2);
+    EXTEND(SP, 4);
     PUSHs(onamesv);
     PUSHs(mnamesv);
+    PUSHs(file);
+    mPUSHu(line);
     PUTBACK;
 
     call_sv(code, G_VOID);