aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c60
1 files changed, 44 insertions, 16 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 3cbb8153bc9..909b3779b06 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4703,11 +4703,6 @@ static struct mmap_region *mmap_regions;
4703 4703
4704static int mmap_fd; 4704static int mmap_fd;
4705 4705
4706/* Temporary storage for mmap_set_vars, see there. */
4707
4708static struct mmap_region *mmap_regions_1;
4709static int mmap_fd_1;
4710
4711/* Page size on this system. */ 4706/* Page size on this system. */
4712 4707
4713static int mmap_page_size; 4708static int mmap_page_size;
@@ -5272,24 +5267,57 @@ init_buffer_once (void)
5272} 5267}
5273 5268
5274void 5269void
5275init_buffer (void) 5270init_buffer (int initialized)
5276{ 5271{
5277 char *pwd; 5272 char *pwd;
5278 Lisp_Object temp; 5273 Lisp_Object temp;
5279 ptrdiff_t len; 5274 ptrdiff_t len;
5280 5275
5281#ifdef USE_MMAP_FOR_BUFFERS 5276#ifdef USE_MMAP_FOR_BUFFERS
5282 { 5277 if (initialized)
5283 struct buffer *b; 5278 {
5279 struct buffer *b;
5284 5280
5285 /* We cannot dump buffers with meaningful addresses that can be 5281#ifndef WINDOWSNT
5286 used by the dumped Emacs. We map new memory for them here. */ 5282 /* These must be reset in the dumped Emacs, to avoid stale
5287 FOR_EACH_BUFFER (b) 5283 references to mmap'ed memory from before the dump.
5288 { 5284
5289 b->text->beg = NULL; 5285 WINDOWSNT doesn't need this because it doesn't track mmap'ed
5290 enlarge_buffer_text (b, 0); 5286 regions by hand (see w32heap.c, which uses system APIs for
5291 } 5287 that purpose), and thus doesn't use mmap_regions. */
5292 } 5288 mmap_regions = NULL;
5289 mmap_fd = -1;
5290#endif
5291
5292 /* The dumped buffers reference addresses of buffer text
5293 recorded by temacs, that cannot be used by the dumped Emacs.
5294 We map new memory for their text here.
5295
5296 Implementation note: the buffers we carry from temacs are:
5297 " prin1", "*scratch*", " *Minibuf-0*", "*Messages*", and
5298 " *code-conversion-work*". They are created by
5299 init_buffer_once and init_window_once (which are not called
5300 in the dumped Emacs), and by the first call to coding.c routines. */
5301 FOR_EACH_BUFFER (b)
5302 {
5303 b->text->beg = NULL;
5304 enlarge_buffer_text (b, 0);
5305 }
5306 }
5307 else
5308 {
5309 struct buffer *b;
5310
5311 /* Only buffers with allocated buffer text should be present at
5312 this point in temacs. */
5313 FOR_EACH_BUFFER (b)
5314 {
5315 eassert (b->text->beg != NULL);
5316 }
5317 }
5318#else /* not USE_MMAP_FOR_BUFFERS */
5319 /* Avoid compiler warnings. */
5320 initialized = initialized;
5293#endif /* USE_MMAP_FOR_BUFFERS */ 5321#endif /* USE_MMAP_FOR_BUFFERS */
5294 5322
5295 Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); 5323 Fset_buffer (Fget_buffer_create (build_string ("*scratch*")));