diff options
| author | Dave Love | 2002-05-17 16:33:41 +0000 |
|---|---|---|
| committer | Dave Love | 2002-05-17 16:33:41 +0000 |
| commit | cab1603fd543a65a455d7975e6f151f61d83827b (patch) | |
| tree | 4873f1849e78324d1d8c7f9f3d34c7e9980fe564 /src/buffer.c | |
| parent | a980c93231c05db0d18ca8cb6c85d26572ab0894 (diff) | |
| download | emacs-cab1603fd543a65a455d7975e6f151f61d83827b.tar.gz emacs-cab1603fd543a65a455d7975e6f151f61d83827b.zip | |
(emacs_strerror): Declare.
(MMAP_ALLOCATED_P, mmap_enlarge, syms_of_buffer): Import changes
from trunk.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/buffer.c b/src/buffer.c index b9c5c2acc52..f050305de59 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Buffer manipulation primitives for GNU Emacs. | 1 | /* Buffer manipulation primitives for GNU Emacs. |
| 2 | Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999, 2000, 2001 | 2 | Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999, 2000, 2001, 2002 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -184,6 +184,7 @@ static void free_buffer_text P_ ((struct buffer *b)); | |||
| 184 | static Lisp_Object copy_overlays P_ ((struct buffer *, Lisp_Object)); | 184 | static Lisp_Object copy_overlays P_ ((struct buffer *, Lisp_Object)); |
| 185 | static void modify_overlay P_ ((struct buffer *, int, int)); | 185 | static void modify_overlay P_ ((struct buffer *, int, int)); |
| 186 | 186 | ||
| 187 | extern char * emacs_strerror P_ ((int)); | ||
| 187 | 188 | ||
| 188 | /* For debugging; temporary. See set_buffer_internal. */ | 189 | /* For debugging; temporary. See set_buffer_internal. */ |
| 189 | /* Lisp_Object Qlisp_mode, Vcheck_symbol; */ | 190 | /* Lisp_Object Qlisp_mode, Vcheck_symbol; */ |
| @@ -4350,6 +4351,18 @@ static int mmap_initialized_p; | |||
| 4350 | 4351 | ||
| 4351 | #define MEM_ALIGN sizeof (double) | 4352 | #define MEM_ALIGN sizeof (double) |
| 4352 | 4353 | ||
| 4354 | /* Predicate returning true if part of the address range [START .. | ||
| 4355 | END[ is currently mapped. Used to prevent overwriting an existing | ||
| 4356 | memory mapping. | ||
| 4357 | |||
| 4358 | Default is to conservativly assume the address range is occupied by | ||
| 4359 | something else. This can be overridden by system configuration | ||
| 4360 | files if system-specific means to determine this exists. */ | ||
| 4361 | |||
| 4362 | #ifndef MMAP_ALLOCATED_P | ||
| 4363 | #define MMAP_ALLOCATED_P(start, end) 1 | ||
| 4364 | #endif | ||
| 4365 | |||
| 4353 | /* Function prototypes. */ | 4366 | /* Function prototypes. */ |
| 4354 | 4367 | ||
| 4355 | static int mmap_free_1 P_ ((struct mmap_region *)); | 4368 | static int mmap_free_1 P_ ((struct mmap_region *)); |
| @@ -4442,16 +4455,13 @@ mmap_enlarge (r, npages) | |||
| 4442 | } | 4455 | } |
| 4443 | else if (npages > 0) | 4456 | else if (npages > 0) |
| 4444 | { | 4457 | { |
| 4445 | struct mmap_region *r2; | ||
| 4446 | |||
| 4447 | nbytes = npages * mmap_page_size; | 4458 | nbytes = npages * mmap_page_size; |
| 4448 | 4459 | ||
| 4449 | /* Try to map additional pages at the end of the region. We | 4460 | /* Try to map additional pages at the end of the region. We |
| 4450 | cannot do this if the address range is already occupied by | 4461 | cannot do this if the address range is already occupied by |
| 4451 | something else because mmap deletes any previous mapping. | 4462 | something else because mmap deletes any previous mapping. |
| 4452 | I'm not sure this is worth doing, let's see. */ | 4463 | I'm not sure this is worth doing, let's see. */ |
| 4453 | r2 = mmap_find (region_end, region_end + nbytes); | 4464 | if (!MMAP_ALLOCATED_P (region_end, region_end + nbytes)) |
| 4454 | if (r2 == NULL) | ||
| 4455 | { | 4465 | { |
| 4456 | POINTER_TYPE *p; | 4466 | POINTER_TYPE *p; |
| 4457 | 4467 | ||
| @@ -4971,8 +4981,9 @@ init_buffer () | |||
| 4971 | if (NILP (buffer_defaults.enable_multibyte_characters)) | 4981 | if (NILP (buffer_defaults.enable_multibyte_characters)) |
| 4972 | Fset_buffer_multibyte (Qnil); | 4982 | Fset_buffer_multibyte (Qnil); |
| 4973 | 4983 | ||
| 4974 | /* If PWD is accurate, use it instead of calling getwd. This is faster | 4984 | /* If PWD is accurate, use it instead of calling getwd. PWD is |
| 4975 | when PWD is right, and may avoid a fatal error. */ | 4985 | sometimes a nicer name, and using it may avoid a fatal error if a |
| 4986 | parent directory is searchable but not readable. */ | ||
| 4976 | if ((pwd = getenv ("PWD")) != 0 | 4987 | if ((pwd = getenv ("PWD")) != 0 |
| 4977 | && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1]))) | 4988 | && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1]))) |
| 4978 | && stat (pwd, &pwdstat) == 0 | 4989 | && stat (pwd, &pwdstat) == 0 |
| @@ -5233,7 +5244,7 @@ nil here means use current buffer's major mode. */); | |||
| 5233 | doc: /* Symbol for current buffer's major mode. */); | 5244 | doc: /* Symbol for current buffer's major mode. */); |
| 5234 | 5245 | ||
| 5235 | DEFVAR_PER_BUFFER ("mode-name", ¤t_buffer->mode_name, | 5246 | DEFVAR_PER_BUFFER ("mode-name", ¤t_buffer->mode_name, |
| 5236 | make_number (Lisp_String), | 5247 | Qnil, |
| 5237 | doc: /* Pretty name of current buffer's major mode (a string). */); | 5248 | doc: /* Pretty name of current buffer's major mode (a string). */); |
| 5238 | 5249 | ||
| 5239 | DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil, | 5250 | DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil, |
| @@ -5286,6 +5297,9 @@ If this is nil, the buffer is saved without any code conversion | |||
| 5286 | unless some coding system is specified in `file-coding-system-alist' | 5297 | unless some coding system is specified in `file-coding-system-alist' |
| 5287 | for the buffer file. | 5298 | for the buffer file. |
| 5288 | 5299 | ||
| 5300 | If the text to be saved cannot be encoded as specified by this variable, | ||
| 5301 | an alternative encoding is selected by `select-safe-coding-system', which see. | ||
| 5302 | |||
| 5289 | The variable `coding-system-for-write', if non-nil, overrides this variable. | 5303 | The variable `coding-system-for-write', if non-nil, overrides this variable. |
| 5290 | 5304 | ||
| 5291 | This variable is never applied to a way of decoding a file while reading it. */); | 5305 | This variable is never applied to a way of decoding a file while reading it. */); |
| @@ -5468,7 +5482,7 @@ from happening repeatedly and making Emacs nonfunctional. */); | |||
| 5468 | Vbefore_change_functions = Qnil; | 5482 | Vbefore_change_functions = Qnil; |
| 5469 | 5483 | ||
| 5470 | DEFVAR_LISP ("after-change-functions", &Vafter_change_functions, | 5484 | DEFVAR_LISP ("after-change-functions", &Vafter_change_functions, |
| 5471 | doc: /* List of function to call after each text change. | 5485 | doc: /* List of functions to call after each text change. |
| 5472 | Three arguments are passed to each function: the positions of | 5486 | Three arguments are passed to each function: the positions of |
| 5473 | the beginning and end of the range of changed text, | 5487 | the beginning and end of the range of changed text, |
| 5474 | and the length in bytes of the pre-change text replaced by that range. | 5488 | and the length in bytes of the pre-change text replaced by that range. |