diff options
| author | Karl Heuer | 1996-01-09 23:40:19 +0000 |
|---|---|---|
| committer | Karl Heuer | 1996-01-09 23:40:19 +0000 |
| commit | 11938f101889459ececb9ae4c533514f4fdb3e4e (patch) | |
| tree | a40aad2626bbdb613720af1b53ba49608a1a3050 /src | |
| parent | 279a482ab2a0d38a84c18c3db680f22ad5af556d (diff) | |
| download | emacs-11938f101889459ececb9ae4c533514f4fdb3e4e.tar.gz emacs-11938f101889459ececb9ae4c533514f4fdb3e4e.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lread.c | 29 |
1 files changed, 17 insertions, 12 deletions
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) | |||
| 1287 | if (saved_doc_string_size == 0) | 1287 | if (saved_doc_string_size == 0) |
| 1288 | { | 1288 | { |
| 1289 | saved_doc_string_size = nskip + 100; | 1289 | saved_doc_string_size = nskip + 100; |
| 1290 | saved_doc_string = (char *) malloc (saved_doc_string_size); | 1290 | saved_doc_string = (char *) xmalloc (saved_doc_string_size); |
| 1291 | } | 1291 | } |
| 1292 | if (nskip > saved_doc_string_size) | 1292 | if (nskip > saved_doc_string_size) |
| 1293 | { | 1293 | { |
| 1294 | saved_doc_string_size = nskip + 100; | 1294 | saved_doc_string_size = nskip + 100; |
| 1295 | saved_doc_string = (char *) realloc (saved_doc_string, | 1295 | saved_doc_string = (char *) xrealloc (saved_doc_string, |
| 1296 | saved_doc_string_size); | 1296 | saved_doc_string_size); |
| 1297 | } | 1297 | } |
| 1298 | 1298 | ||
| 1299 | saved_doc_string_position = ftell (instream); | 1299 | saved_doc_string_position = ftell (instream); |
| @@ -2222,6 +2222,10 @@ defvar_kboard (namestring, offset) | |||
| 2222 | XSYMBOL (sym)->value = val; | 2222 | XSYMBOL (sym)->value = val; |
| 2223 | } | 2223 | } |
| 2224 | 2224 | ||
| 2225 | /* Record the value of load-path used at the start of dumping | ||
| 2226 | so we can see if the site changed it later during dumping. */ | ||
| 2227 | static Lisp_Object dump_path; | ||
| 2228 | |||
| 2225 | init_lread () | 2229 | init_lread () |
| 2226 | { | 2230 | { |
| 2227 | char *normal; | 2231 | char *normal; |
| @@ -2244,12 +2248,8 @@ init_lread () | |||
| 2244 | from the default before dumping, don't override that value. */ | 2248 | from the default before dumping, don't override that value. */ |
| 2245 | if (initialized) | 2249 | if (initialized) |
| 2246 | { | 2250 | { |
| 2247 | Lisp_Object dump_path; | ||
| 2248 | |||
| 2249 | dump_path = decode_env_path (0, PATH_DUMPLOADSEARCH); | ||
| 2250 | |||
| 2251 | Vsource_directory = Fexpand_file_name (build_string ("../"), | 2251 | Vsource_directory = Fexpand_file_name (build_string ("../"), |
| 2252 | Fcar (dump_path)); | 2252 | Fcar (Fcdr (dump_path))); |
| 2253 | 2253 | ||
| 2254 | if (! NILP (Fequal (dump_path, Vload_path))) | 2254 | if (! NILP (Fequal (dump_path, Vload_path))) |
| 2255 | { | 2255 | { |
| @@ -2288,10 +2288,13 @@ init_lread () | |||
| 2288 | } | 2288 | } |
| 2289 | } | 2289 | } |
| 2290 | else | 2290 | else |
| 2291 | /* ../lisp refers to the build directory. | 2291 | { |
| 2292 | NORMAL refers to the lisp dir in the source directory. */ | 2292 | /* ../lisp refers to the build directory. |
| 2293 | Vload_path = Fcons (build_string ("../lisp"), | 2293 | NORMAL refers to the lisp dir in the source directory. */ |
| 2294 | decode_env_path (0, normal)); | 2294 | Vload_path = Fcons (build_string ("../lisp"), |
| 2295 | decode_env_path (0, normal)); | ||
| 2296 | dump_path = Vload_path; | ||
| 2297 | } | ||
| 2295 | #endif | 2298 | #endif |
| 2296 | 2299 | ||
| 2297 | #ifndef WINDOWSNT | 2300 | #ifndef WINDOWSNT |
| @@ -2456,4 +2459,6 @@ You cannot count on them to still be there!"); | |||
| 2456 | 2459 | ||
| 2457 | Qload_file_name = intern ("load-file-name"); | 2460 | Qload_file_name = intern ("load-file-name"); |
| 2458 | staticpro (&Qload_file_name); | 2461 | staticpro (&Qload_file_name); |
| 2462 | |||
| 2463 | staticpro (&dump_path); | ||
| 2459 | } | 2464 | } |