/[emacs]/emacs/src/lread.c
ViewVC logotype

Diff of /emacs/src/lread.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.272 by rms, Sun Nov 11 20:10:28 2001 UTC revision 1.273 by rms, Sun Nov 25 02:13:13 2001 UTC
# Line 181  static int new_backquote_flag; Line 181  static int new_backquote_flag;
181    
182  static Lisp_Object Vloads_in_progress;  static Lisp_Object Vloads_in_progress;
183    
 /* Limit of the depth of recursive loads.  */  
   
 Lisp_Object Vrecursive_load_depth_limit;  
   
184  /* Non-zero means load dangerous compiled Lisp files.  */  /* Non-zero means load dangerous compiled Lisp files.  */
185    
186  int load_dangerous_libraries;  int load_dangerous_libraries;
# Line 734  Return t if file exists.  */) Line 730  Return t if file exists.  */)
730    
731       Also, just loading a file recursively is not always an error in       Also, just loading a file recursively is not always an error in
732       the general case; the second load may do something different.  */       the general case; the second load may do something different.  */
733    if (INTEGERP (Vrecursive_load_depth_limit)    {
734        && XINT (Vrecursive_load_depth_limit) > 0)      int count = 0;
735      {      Lisp_Object tem;
736        Lisp_Object len = Flength (Vloads_in_progress);      for (tem = Vloads_in_progress; CONSP (tem); tem = XCDR (tem))
737        if (XFASTINT (len) > XFASTINT (Vrecursive_load_depth_limit))        if (!NILP (Fequal (found, XCAR (tem))))
738          Fsignal (Qerror, Fcons (build_string ("Recursive load suspected"),          count++;
739                                  Fcons (found, Vloads_in_progress)));      if (count > 3)
740        record_unwind_protect (record_load_unwind, Vloads_in_progress);        Fsignal (Qerror, Fcons (build_string ("Recursive load"),
741        Vloads_in_progress = Fcons (found, Vloads_in_progress);                                Fcons (found, Vloads_in_progress)));
742      }      record_unwind_protect (record_load_unwind, Vloads_in_progress);
743        Vloads_in_progress = Fcons (found, Vloads_in_progress);
744      }
745    
746    if (!bcmp (&(XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 4]),    if (!bcmp (&(XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 4]),
747               ".elc", 4))               ".elc", 4))
# Line 3658  to load.  See also `load-dangerous-libra Line 3656  to load.  See also `load-dangerous-libra
3656    Vbytecomp_version_regexp    Vbytecomp_version_regexp
3657      = build_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)");      = build_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)");
3658    
   DEFVAR_LISP ("recursive-load-depth-limit", &Vrecursive_load_depth_limit,  
                doc: /* Limit for depth of recursive loads.  
 Value should be either an integer > 0 specifying the limit, or nil for  
 no limit.  */);  
   Vrecursive_load_depth_limit = make_number (50);  
   
3659    /* Vsource_directory was initialized in init_lread.  */    /* Vsource_directory was initialized in init_lread.  */
3660    
3661    load_descriptor_list = Qnil;    load_descriptor_list = Qnil;

Legend:
Removed from v.1.272  
changed lines
  Added in v.1.273

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26