This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Introduce macro PERL_MAX_SUB_DEPTH
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 11 Jan 2008 11:31:34 +0000 (11:31 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 11 Jan 2008 11:31:34 +0000 (11:31 +0000)
p4raw-id: //depot/perl@32949

perl.h
pp_ctl.c
pp_hot.c

diff --git a/perl.h b/perl.h
index fa677ca..c028bba 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -919,6 +919,11 @@ EXTERN_C int usleep(unsigned int);
 #define PERL_ARENA_SIZE 4080
 #endif
 
+/* Maximum level of recursion */
+#ifndef PERL_MAX_SUB_DEPTH
+#define PERL_MAX_SUB_DEPTH 100
+#endif
+
 #endif /* PERL_CORE */
 
 /* We no longer default to creating a new SV for GvSV.
index 07f8504..564e437 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2427,7 +2427,7 @@ PP(pp_goto)
                if (CvDEPTH(cv) < 2)
                    SvREFCNT_inc_simple_void_NN(cv);
                else {
-                   if (CvDEPTH(cv) == 100 && ckWARN(WARN_RECURSION))
+                   if (CvDEPTH(cv) == PERL_MAX_SUB_DEPTH && ckWARN(WARN_RECURSION))
                        sub_crush_depth(cv);
                    pad_push(padlist, CvDEPTH(cv));
                }
index a24f802..e3eebe6 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2830,7 +2830,7 @@ try_autoload:
         * stuff so that __WARN__ handlers can safely dounwind()
         * if they want to
         */
-       if (CvDEPTH(cv) == 100 && ckWARN(WARN_RECURSION)
+       if (CvDEPTH(cv) == PERL_MAX_SUB_DEPTH && ckWARN(WARN_RECURSION)
            && !(PERLDB_SUB && cv == GvCV(PL_DBsub)))
            sub_crush_depth(cv);
 #if 0