From: Karl Heuer Date: Tue, 9 Jan 1996 23:40:19 +0000 (+0000) Subject: (read1): Use xmalloc and xrealloc, not malloc and realloc. X-Git-Tag: emacs-19.34~1730 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=11938f101889459ececb9ae4c533514f4fdb3e4e;p=emacs.git (read1): Use xmalloc and xrealloc, not malloc and realloc. (dump_path): New static var. (init_lread): Use that to record dump-time initial path. Delete the local var dump_path; find Vsource_directory differently. (syms_of_lread): staticpro it. --- diff --git a/src/lread.c b/src/lread.c index f1d8ea94691..377e6ed2e40 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1287,13 +1287,13 @@ read1 (readcharfun, pch, first_in_list) if (saved_doc_string_size == 0) { saved_doc_string_size = nskip + 100; - saved_doc_string = (char *) malloc (saved_doc_string_size); + saved_doc_string = (char *) xmalloc (saved_doc_string_size); } if (nskip > saved_doc_string_size) { saved_doc_string_size = nskip + 100; - saved_doc_string = (char *) realloc (saved_doc_string, - saved_doc_string_size); + saved_doc_string = (char *) xrealloc (saved_doc_string, + saved_doc_string_size); } saved_doc_string_position = ftell (instream); @@ -2222,6 +2222,10 @@ defvar_kboard (namestring, offset) XSYMBOL (sym)->value = val; } +/* Record the value of load-path used at the start of dumping + so we can see if the site changed it later during dumping. */ +static Lisp_Object dump_path; + init_lread () { char *normal; @@ -2244,12 +2248,8 @@ init_lread () from the default before dumping, don't override that value. */ if (initialized) { - Lisp_Object dump_path; - - dump_path = decode_env_path (0, PATH_DUMPLOADSEARCH); - Vsource_directory = Fexpand_file_name (build_string ("../"), - Fcar (dump_path)); + Fcar (Fcdr (dump_path))); if (! NILP (Fequal (dump_path, Vload_path))) { @@ -2288,10 +2288,13 @@ init_lread () } } else - /* ../lisp refers to the build directory. - NORMAL refers to the lisp dir in the source directory. */ - Vload_path = Fcons (build_string ("../lisp"), - decode_env_path (0, normal)); + { + /* ../lisp refers to the build directory. + NORMAL refers to the lisp dir in the source directory. */ + Vload_path = Fcons (build_string ("../lisp"), + decode_env_path (0, normal)); + dump_path = Vload_path; + } #endif #ifndef WINDOWSNT @@ -2456,4 +2459,6 @@ You cannot count on them to still be there!"); Qload_file_name = intern ("load-file-name"); staticpro (&Qload_file_name); + + staticpro (&dump_path); }