comparison src/lread.c @ 4608:1e3cf11fa27d

Make #$ truly read-only for Lisp; check this in the test suite. lisp/ChangeLog addition: 2009-02-10 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el : Check that #$ is not modifiable from Lisp, and that load-file-name is modifiable from Lisp. src/ChangeLog addition: 2009-02-10 Aidan Kehoe <kehoea@parhasard.net> * lread.c (Fload_internal): Make load-file-name-internal readonly for Lisp code; make load-file-name a modifiable copy. (init_lread): Initialised Vload_file_name_internal, Vload_file_name to nil on each post-dump start.
author Aidan Kehoe <kehoea@parhasard.net>
date Tue, 10 Feb 2009 16:07:31 +0000
parents 7869173584fc
children 8f1ee2d15784
comparison
equal deleted inserted replaced
4607:517f6887fbc0 4608:1e3cf11fa27d
709 PRINT_LOADING_MESSAGE_1 ("%sLoading %s...", done); \ 709 PRINT_LOADING_MESSAGE_1 ("%sLoading %s...", done); \
710 } while (0) 710 } while (0)
711 711
712 PRINT_LOADING_MESSAGE (""); 712 PRINT_LOADING_MESSAGE ("");
713 713
714 LISP_READONLY (found) = 1;
715
714 { 716 {
715 /* Lisp_Object's must be malloc'ed, not stack-allocated */ 717 /* Lisp_Object's must be malloc'ed, not stack-allocated */
716 Lisp_Object lispstream = Qnil; 718 Lisp_Object lispstream = Qnil;
717 const int block_size = 8192; 719 const int block_size = 8192;
718 struct gcpro ngcpro1; 720 struct gcpro ngcpro1;
736 internal_bind_lisp_object (&Vload_file_name_internal, found); 738 internal_bind_lisp_object (&Vload_file_name_internal, found);
737 /* this is not a simple internal_bind. */ 739 /* this is not a simple internal_bind. */
738 record_unwind_protect (load_force_doc_string_unwind, 740 record_unwind_protect (load_force_doc_string_unwind,
739 Vload_force_doc_string_list); 741 Vload_force_doc_string_list);
740 Vload_force_doc_string_list = Qnil; 742 Vload_force_doc_string_list = Qnil;
741 internal_bind_lisp_object (&Vload_file_name, found); 743 /* load-file-name is not read-only to Lisp. */
744 internal_bind_lisp_object (&Vload_file_name, Fcopy_sequence(found));
742 #ifdef I18N3 745 #ifdef I18N3
743 /* set it to nil; a call to #'domain will set it. */ 746 /* set it to nil; a call to #'domain will set it. */
744 internal_bind_lisp_object (&Vfile_domain, Qnil); 747 internal_bind_lisp_object (&Vfile_domain, Qnil);
745 #endif 748 #endif
746 749
3264 will initialize it only once, at dump-time. */ 3267 will initialize it only once, at dump-time. */
3265 if (NILP (Vread_buffer_stream)) 3268 if (NILP (Vread_buffer_stream))
3266 Vread_buffer_stream = make_resizing_buffer_output_stream (); 3269 Vread_buffer_stream = make_resizing_buffer_output_stream ();
3267 3270
3268 Vload_force_doc_string_list = Qnil; 3271 Vload_force_doc_string_list = Qnil;
3272
3273 Vload_file_name_internal = Qnil;
3274 Vload_file_name = Qnil;
3269 } 3275 }
3270 3276
3271 void 3277 void
3272 syms_of_lread (void) 3278 syms_of_lread (void)
3273 { 3279 {