Commit 11938f10 authored by Karl Heuer's avatar Karl Heuer
Browse files

(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.
parent 279a482a
...@@ -1287,12 +1287,12 @@ read1 (readcharfun, pch, first_in_list) ...@@ -1287,12 +1287,12 @@ read1 (readcharfun, pch, first_in_list)
if (saved_doc_string_size == 0) if (saved_doc_string_size == 0)
{ {
saved_doc_string_size = nskip + 100; 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) if (nskip > saved_doc_string_size)
{ {
saved_doc_string_size = nskip + 100; saved_doc_string_size = nskip + 100;
saved_doc_string = (char *) realloc (saved_doc_string, saved_doc_string = (char *) xrealloc (saved_doc_string,
saved_doc_string_size); saved_doc_string_size);
} }
...@@ -2222,6 +2222,10 @@ defvar_kboard (namestring, offset) ...@@ -2222,6 +2222,10 @@ defvar_kboard (namestring, offset)
XSYMBOL (sym)->value = val; 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 () init_lread ()
{ {
char *normal; char *normal;
...@@ -2244,12 +2248,8 @@ init_lread () ...@@ -2244,12 +2248,8 @@ init_lread ()
from the default before dumping, don't override that value. */ from the default before dumping, don't override that value. */
if (initialized) if (initialized)
{ {
Lisp_Object dump_path;
dump_path = decode_env_path (0, PATH_DUMPLOADSEARCH);
Vsource_directory = Fexpand_file_name (build_string ("../"), Vsource_directory = Fexpand_file_name (build_string ("../"),
Fcar (dump_path)); Fcar (Fcdr (dump_path)));
if (! NILP (Fequal (dump_path, Vload_path))) if (! NILP (Fequal (dump_path, Vload_path)))
{ {
...@@ -2288,10 +2288,13 @@ init_lread () ...@@ -2288,10 +2288,13 @@ init_lread ()
} }
} }
else else
{
/* ../lisp refers to the build directory. /* ../lisp refers to the build directory.
NORMAL refers to the lisp dir in the source directory. */ NORMAL refers to the lisp dir in the source directory. */
Vload_path = Fcons (build_string ("../lisp"), Vload_path = Fcons (build_string ("../lisp"),
decode_env_path (0, normal)); decode_env_path (0, normal));
dump_path = Vload_path;
}
#endif #endif
#ifndef WINDOWSNT #ifndef WINDOWSNT
...@@ -2456,4 +2459,6 @@ You cannot count on them to still be there!"); ...@@ -2456,4 +2459,6 @@ You cannot count on them to still be there!");
Qload_file_name = intern ("load-file-name"); Qload_file_name = intern ("load-file-name");
staticpro (&Qload_file_name); staticpro (&Qload_file_name);
staticpro (&dump_path);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment