]> git.vpit.fr Git - perl/modules/indirect.git/blobdiff - indirect.xs
Tighten the scope of pl_linestr in indirect_map_store()
[perl/modules/indirect.git] / indirect.xs
index 696cf5e2a16062e687021062ce48b17dd34e9c01..85741a83de37d18e6bfec577bbf577737627e75b 100644 (file)
@@ -95,7 +95,6 @@ STATIC const char *indirect_linestr = NULL;
 STATIC void indirect_map_store(pTHX_ const OP *o, const char *src, SV *sv) {
 #define indirect_map_store(O, S, N) indirect_map_store(aTHX_ (O), (S), (N))
  OP2STR_BUF;
- const char *pl_linestr;
  SV *val;
 
  /* When lex_inwhat is set, we're in a quotelike environment (qq, qr, but not q)
@@ -103,7 +102,7 @@ STATIC void indirect_map_store(pTHX_ const OP *o, const char *src, SV *sv) {
   * still be alive somewhere. */
 
  if (!PL_lex_inwhat) {
-  pl_linestr = SvPVX_const(PL_linestr);
+  const char *pl_linestr = SvPVX_const(PL_linestr);
   if (indirect_linestr != pl_linestr) {
    hv_clear(indirect_map);
    indirect_linestr = pl_linestr;
@@ -347,8 +346,14 @@ STATIC OP *indirect_ck_entersub(pTHX_ OP *o) {
    goto done;
 
   mpos = indirect_map_fetch(mop, &mnamesv);
+  if (!mpos)
+   goto done;
+
   opos = indirect_map_fetch(oop, &onamesv);
-  if (mpos && opos && mpos < opos) {
+  if (!opos)
+   goto done;
+
+  if (mpos < opos) {
    const char *mname = SvPV_nolen_const(mnamesv);
    const char *oname = SvPV_nolen_const(onamesv);
    if (hint == 2)