diff options
| author | Paul Eggert | 2012-08-23 21:37:57 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-08-23 21:37:57 -0700 |
| commit | 37ef52bb653c99525c3ecf7cd1ca4ff15de7dec5 (patch) | |
| tree | f72e329434e03df19b392a8f82d811e6cec7fa5b /src/buffer.c | |
| parent | ca5256ad0a138d14329ca80a0a4fd952ca2cd092 (diff) | |
| download | emacs-37ef52bb653c99525c3ecf7cd1ca4ff15de7dec5.tar.gz emacs-37ef52bb653c99525c3ecf7cd1ca4ff15de7dec5.zip | |
* buffer.c, buffer.h: Use bool for boolean.
* buffer.c (reset_buffer_local_variables)
(buffer_lisp_local_variables, Fset_buffer_modified_p)
(Frestore_buffer_modified_p, Fset_buffer_multibyte):
(overlays_at, overlays_in, mouse_face_overlay_overlaps)
(overlay_touches_p, overlay_strings, Foverlay_put)
(report_overlay_modification, call_overlay_mod_hooks):
(mmap_enlarge, mmap_set_vars):
* buffer.h (buffer_has_overlays, uppercasep, lowercasep):
Use bool for booleans, instead of int.
* buffer.c (compact_buffer, mmap_free_1): Return void, not int,
since the 1-or-0 return value is always ignored anyway.
(mmap_initialized_p):
* buffer.h (struct buffer_text.inhibit_shrinking): Now bool, not int.
* buffer.h, lisp.h: Adjust prototypes to match above changes.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 118 |
1 files changed, 53 insertions, 65 deletions
diff --git a/src/buffer.c b/src/buffer.c index c900ef8c5a8..4d606c2105a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -110,10 +110,10 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS]; | |||
| 110 | int last_per_buffer_idx; | 110 | int last_per_buffer_idx; |
| 111 | 111 | ||
| 112 | static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, | 112 | static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, |
| 113 | int after, Lisp_Object arg1, | 113 | bool after, Lisp_Object arg1, |
| 114 | Lisp_Object arg2, Lisp_Object arg3); | 114 | Lisp_Object arg2, Lisp_Object arg3); |
| 115 | static void swap_out_buffer_local_variables (struct buffer *b); | 115 | static void swap_out_buffer_local_variables (struct buffer *b); |
| 116 | static void reset_buffer_local_variables (struct buffer *b, int permanent_too); | 116 | static void reset_buffer_local_variables (struct buffer *, bool); |
| 117 | 117 | ||
| 118 | /* Alist of all buffer names vs the buffers. */ | 118 | /* Alist of all buffer names vs the buffers. */ |
| 119 | /* This used to be a variable, but is no longer, | 119 | /* This used to be a variable, but is no longer, |
| @@ -155,7 +155,7 @@ static void alloc_buffer_text (struct buffer *, ptrdiff_t); | |||
| 155 | static void free_buffer_text (struct buffer *b); | 155 | static void free_buffer_text (struct buffer *b); |
| 156 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); | 156 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); |
| 157 | static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); | 157 | static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 158 | static Lisp_Object buffer_lisp_local_variables (struct buffer *, int); | 158 | static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool); |
| 159 | 159 | ||
| 160 | /* These setters are used only in this file, so they can be private. */ | 160 | /* These setters are used only in this file, so they can be private. */ |
| 161 | static inline void | 161 | static inline void |
| @@ -979,15 +979,13 @@ reset_buffer (register struct buffer *b) | |||
| 979 | it does not treat permanent locals consistently. | 979 | it does not treat permanent locals consistently. |
| 980 | Instead, use Fkill_all_local_variables. | 980 | Instead, use Fkill_all_local_variables. |
| 981 | 981 | ||
| 982 | If PERMANENT_TOO is 1, then we reset permanent | 982 | If PERMANENT_TOO, reset permanent buffer-local variables. |
| 983 | buffer-local variables. If PERMANENT_TOO is 0, | 983 | If not, preserve those. */ |
| 984 | we preserve those. */ | ||
| 985 | 984 | ||
| 986 | static void | 985 | static void |
| 987 | reset_buffer_local_variables (register struct buffer *b, int permanent_too) | 986 | reset_buffer_local_variables (struct buffer *b, bool permanent_too) |
| 988 | { | 987 | { |
| 989 | register int offset; | 988 | int offset, i; |
| 990 | int i; | ||
| 991 | 989 | ||
| 992 | /* Reset the major mode to Fundamental, together with all the | 990 | /* Reset the major mode to Fundamental, together with all the |
| 993 | things that depend on the major mode. | 991 | things that depend on the major mode. |
| @@ -1253,14 +1251,14 @@ buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer) | |||
| 1253 | /* Return an alist of the Lisp-level buffer-local bindings of | 1251 | /* Return an alist of the Lisp-level buffer-local bindings of |
| 1254 | buffer BUF. That is, don't include the variables maintained | 1252 | buffer BUF. That is, don't include the variables maintained |
| 1255 | in special slots in the buffer object. | 1253 | in special slots in the buffer object. |
| 1256 | If CLONE is zero elements of the form (VAR . unbound) are replaced | 1254 | If not CLONE, replace elements of the form (VAR . unbound) |
| 1257 | by VAR. */ | 1255 | by VAR. */ |
| 1258 | 1256 | ||
| 1259 | static Lisp_Object | 1257 | static Lisp_Object |
| 1260 | buffer_lisp_local_variables (struct buffer *buf, int clone) | 1258 | buffer_lisp_local_variables (struct buffer *buf, bool clone) |
| 1261 | { | 1259 | { |
| 1262 | Lisp_Object result = Qnil; | 1260 | Lisp_Object result = Qnil; |
| 1263 | register Lisp_Object tail; | 1261 | Lisp_Object tail; |
| 1264 | for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) | 1262 | for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) |
| 1265 | { | 1263 | { |
| 1266 | Lisp_Object val, elt; | 1264 | Lisp_Object val, elt; |
| @@ -1351,11 +1349,9 @@ DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, | |||
| 1351 | 1, 1, 0, | 1349 | 1, 1, 0, |
| 1352 | doc: /* Mark current buffer as modified or unmodified according to FLAG. | 1350 | doc: /* Mark current buffer as modified or unmodified according to FLAG. |
| 1353 | A non-nil FLAG means mark the buffer modified. */) | 1351 | A non-nil FLAG means mark the buffer modified. */) |
| 1354 | (register Lisp_Object flag) | 1352 | (Lisp_Object flag) |
| 1355 | { | 1353 | { |
| 1356 | register int already; | 1354 | Lisp_Object fn, buffer, window; |
| 1357 | register Lisp_Object fn; | ||
| 1358 | Lisp_Object buffer, window; | ||
| 1359 | 1355 | ||
| 1360 | #ifdef CLASH_DETECTION | 1356 | #ifdef CLASH_DETECTION |
| 1361 | /* If buffer becoming modified, lock the file. | 1357 | /* If buffer becoming modified, lock the file. |
| @@ -1365,7 +1361,7 @@ A non-nil FLAG means mark the buffer modified. */) | |||
| 1365 | /* Test buffer-file-name so that binding it to nil is effective. */ | 1361 | /* Test buffer-file-name so that binding it to nil is effective. */ |
| 1366 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) | 1362 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) |
| 1367 | { | 1363 | { |
| 1368 | already = SAVE_MODIFF < MODIFF; | 1364 | bool already = SAVE_MODIFF < MODIFF; |
| 1369 | if (!already && !NILP (flag)) | 1365 | if (!already && !NILP (flag)) |
| 1370 | lock_file (fn); | 1366 | lock_file (fn); |
| 1371 | else if (already && NILP (flag)) | 1367 | else if (already && NILP (flag)) |
| @@ -1432,7 +1428,7 @@ state of the current buffer. Use with care. */) | |||
| 1432 | /* Test buffer-file-name so that binding it to nil is effective. */ | 1428 | /* Test buffer-file-name so that binding it to nil is effective. */ |
| 1433 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) | 1429 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) |
| 1434 | { | 1430 | { |
| 1435 | int already = SAVE_MODIFF < MODIFF; | 1431 | bool already = SAVE_MODIFF < MODIFF; |
| 1436 | if (!already && !NILP (flag)) | 1432 | if (!already && !NILP (flag)) |
| 1437 | lock_file (fn); | 1433 | lock_file (fn); |
| 1438 | else if (already && NILP (flag)) | 1434 | else if (already && NILP (flag)) |
| @@ -1676,7 +1672,7 @@ No argument or nil as argument means do this for the current buffer. */) | |||
| 1676 | 1672 | ||
| 1677 | /* Truncate undo list and shrink the gap of BUFFER. */ | 1673 | /* Truncate undo list and shrink the gap of BUFFER. */ |
| 1678 | 1674 | ||
| 1679 | int | 1675 | void |
| 1680 | compact_buffer (struct buffer *buffer) | 1676 | compact_buffer (struct buffer *buffer) |
| 1681 | { | 1677 | { |
| 1682 | /* Verify indirection counters. */ | 1678 | /* Verify indirection counters. */ |
| @@ -1718,9 +1714,7 @@ compact_buffer (struct buffer *buffer) | |||
| 1718 | } | 1714 | } |
| 1719 | } | 1715 | } |
| 1720 | buffer->text->compact = buffer->text->modiff; | 1716 | buffer->text->compact = buffer->text->modiff; |
| 1721 | return 1; | ||
| 1722 | } | 1717 | } |
| 1723 | return 0; | ||
| 1724 | } | 1718 | } |
| 1725 | 1719 | ||
| 1726 | DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ", | 1720 | DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ", |
| @@ -2471,8 +2465,8 @@ current buffer is cleared. */) | |||
| 2471 | struct Lisp_Marker *tail, *markers; | 2465 | struct Lisp_Marker *tail, *markers; |
| 2472 | struct buffer *other; | 2466 | struct buffer *other; |
| 2473 | ptrdiff_t begv, zv; | 2467 | ptrdiff_t begv, zv; |
| 2474 | int narrowed = (BEG != BEGV || Z != ZV); | 2468 | bool narrowed = (BEG != BEGV || Z != ZV); |
| 2475 | int modified_p = !NILP (Fbuffer_modified_p (Qnil)); | 2469 | bool modified_p = !NILP (Fbuffer_modified_p (Qnil)); |
| 2476 | Lisp_Object old_undo = BVAR (current_buffer, undo_list); | 2470 | Lisp_Object old_undo = BVAR (current_buffer, undo_list); |
| 2477 | struct gcpro gcpro1; | 2471 | struct gcpro gcpro1; |
| 2478 | 2472 | ||
| @@ -2821,19 +2815,19 @@ swap_out_buffer_local_variables (struct buffer *b) | |||
| 2821 | *VEC_PTR and *LEN_PTR should contain a valid vector and size | 2815 | *VEC_PTR and *LEN_PTR should contain a valid vector and size |
| 2822 | when this function is called. | 2816 | when this function is called. |
| 2823 | 2817 | ||
| 2824 | If EXTEND is non-zero, we make the vector bigger if necessary. | 2818 | If EXTEND, make the vector bigger if necessary. |
| 2825 | If EXTEND is zero, we never extend the vector, | 2819 | If not, never extend the vector, |
| 2826 | and we store only as many overlays as will fit. | 2820 | and store only as many overlays as will fit. |
| 2827 | But we still return the total number of overlays. | 2821 | But still return the total number of overlays. |
| 2828 | 2822 | ||
| 2829 | If CHANGE_REQ is true, then any position written into *PREV_PTR or | 2823 | If CHANGE_REQ, any position written into *PREV_PTR or |
| 2830 | *NEXT_PTR is guaranteed to be not equal to POS, unless it is the | 2824 | *NEXT_PTR is guaranteed to be not equal to POS, unless it is the |
| 2831 | default (BEGV or ZV). */ | 2825 | default (BEGV or ZV). */ |
| 2832 | 2826 | ||
| 2833 | ptrdiff_t | 2827 | ptrdiff_t |
| 2834 | overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | 2828 | overlays_at (EMACS_INT pos, bool extend, Lisp_Object **vec_ptr, |
| 2835 | ptrdiff_t *len_ptr, | 2829 | ptrdiff_t *len_ptr, |
| 2836 | ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, int change_req) | 2830 | ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, bool change_req) |
| 2837 | { | 2831 | { |
| 2838 | Lisp_Object overlay, start, end; | 2832 | Lisp_Object overlay, start, end; |
| 2839 | struct Lisp_Overlay *tail; | 2833 | struct Lisp_Overlay *tail; |
| @@ -2842,7 +2836,7 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | |||
| 2842 | Lisp_Object *vec = *vec_ptr; | 2836 | Lisp_Object *vec = *vec_ptr; |
| 2843 | ptrdiff_t next = ZV; | 2837 | ptrdiff_t next = ZV; |
| 2844 | ptrdiff_t prev = BEGV; | 2838 | ptrdiff_t prev = BEGV; |
| 2845 | int inhibit_storing = 0; | 2839 | bool inhibit_storing = 0; |
| 2846 | 2840 | ||
| 2847 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 2841 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 2848 | { | 2842 | { |
| @@ -2959,13 +2953,13 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | |||
| 2959 | *VEC_PTR and *LEN_PTR should contain a valid vector and size | 2953 | *VEC_PTR and *LEN_PTR should contain a valid vector and size |
| 2960 | when this function is called. | 2954 | when this function is called. |
| 2961 | 2955 | ||
| 2962 | If EXTEND is non-zero, we make the vector bigger if necessary. | 2956 | If EXTEND, make the vector bigger if necessary. |
| 2963 | If EXTEND is zero, we never extend the vector, | 2957 | If not, never extend the vector, |
| 2964 | and we store only as many overlays as will fit. | 2958 | and store only as many overlays as will fit. |
| 2965 | But we still return the total number of overlays. */ | 2959 | But still return the total number of overlays. */ |
| 2966 | 2960 | ||
| 2967 | static ptrdiff_t | 2961 | static ptrdiff_t |
| 2968 | overlays_in (EMACS_INT beg, EMACS_INT end, int extend, | 2962 | overlays_in (EMACS_INT beg, EMACS_INT end, bool extend, |
| 2969 | Lisp_Object **vec_ptr, ptrdiff_t *len_ptr, | 2963 | Lisp_Object **vec_ptr, ptrdiff_t *len_ptr, |
| 2970 | ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr) | 2964 | ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr) |
| 2971 | { | 2965 | { |
| @@ -2976,8 +2970,8 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend, | |||
| 2976 | Lisp_Object *vec = *vec_ptr; | 2970 | Lisp_Object *vec = *vec_ptr; |
| 2977 | ptrdiff_t next = ZV; | 2971 | ptrdiff_t next = ZV; |
| 2978 | ptrdiff_t prev = BEGV; | 2972 | ptrdiff_t prev = BEGV; |
| 2979 | int inhibit_storing = 0; | 2973 | bool inhibit_storing = 0; |
| 2980 | int end_is_Z = end == Z; | 2974 | bool end_is_Z = end == Z; |
| 2981 | 2975 | ||
| 2982 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 2976 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 2983 | { | 2977 | { |
| @@ -3078,10 +3072,10 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend, | |||
| 3078 | } | 3072 | } |
| 3079 | 3073 | ||
| 3080 | 3074 | ||
| 3081 | /* Return non-zero if there exists an overlay with a non-nil | 3075 | /* Return true if there exists an overlay with a non-nil |
| 3082 | `mouse-face' property overlapping OVERLAY. */ | 3076 | `mouse-face' property overlapping OVERLAY. */ |
| 3083 | 3077 | ||
| 3084 | int | 3078 | bool |
| 3085 | mouse_face_overlay_overlaps (Lisp_Object overlay) | 3079 | mouse_face_overlay_overlaps (Lisp_Object overlay) |
| 3086 | { | 3080 | { |
| 3087 | ptrdiff_t start = OVERLAY_POSITION (OVERLAY_START (overlay)); | 3081 | ptrdiff_t start = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| @@ -3110,7 +3104,7 @@ mouse_face_overlay_overlaps (Lisp_Object overlay) | |||
| 3110 | 3104 | ||
| 3111 | 3105 | ||
| 3112 | /* Fast function to just test if we're at an overlay boundary. */ | 3106 | /* Fast function to just test if we're at an overlay boundary. */ |
| 3113 | int | 3107 | bool |
| 3114 | overlay_touches_p (ptrdiff_t pos) | 3108 | overlay_touches_p (ptrdiff_t pos) |
| 3115 | { | 3109 | { |
| 3116 | Lisp_Object overlay; | 3110 | Lisp_Object overlay; |
| @@ -3327,7 +3321,7 @@ overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr) | |||
| 3327 | Lisp_Object overlay, window, str; | 3321 | Lisp_Object overlay, window, str; |
| 3328 | struct Lisp_Overlay *ov; | 3322 | struct Lisp_Overlay *ov; |
| 3329 | ptrdiff_t startpos, endpos; | 3323 | ptrdiff_t startpos, endpos; |
| 3330 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); | 3324 | bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 3331 | 3325 | ||
| 3332 | overlay_heads.used = overlay_heads.bytes = 0; | 3326 | overlay_heads.used = overlay_heads.bytes = 0; |
| 3333 | overlay_tails.used = overlay_tails.bytes = 0; | 3327 | overlay_tails.used = overlay_tails.bytes = 0; |
| @@ -4321,7 +4315,7 @@ VALUE will be returned.*/) | |||
| 4321 | (Lisp_Object overlay, Lisp_Object prop, Lisp_Object value) | 4315 | (Lisp_Object overlay, Lisp_Object prop, Lisp_Object value) |
| 4322 | { | 4316 | { |
| 4323 | Lisp_Object tail, buffer; | 4317 | Lisp_Object tail, buffer; |
| 4324 | int changed; | 4318 | bool changed; |
| 4325 | 4319 | ||
| 4326 | CHECK_OVERLAY (overlay); | 4320 | CHECK_OVERLAY (overlay); |
| 4327 | 4321 | ||
| @@ -4396,7 +4390,7 @@ add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) | |||
| 4396 | and the insert-after-hooks of overlay ending at START. | 4390 | and the insert-after-hooks of overlay ending at START. |
| 4397 | 4391 | ||
| 4398 | This is called both before and after the modification. | 4392 | This is called both before and after the modification. |
| 4399 | AFTER is nonzero when we call after the modification. | 4393 | AFTER is true when we call after the modification. |
| 4400 | 4394 | ||
| 4401 | ARG1, ARG2, ARG3 are arguments to pass to the hook functions. | 4395 | ARG1, ARG2, ARG3 are arguments to pass to the hook functions. |
| 4402 | When AFTER is nonzero, they are the start position, | 4396 | When AFTER is nonzero, they are the start position, |
| @@ -4404,13 +4398,13 @@ add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) | |||
| 4404 | and the length of deleted or replaced old text. */ | 4398 | and the length of deleted or replaced old text. */ |
| 4405 | 4399 | ||
| 4406 | void | 4400 | void |
| 4407 | report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, | 4401 | report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, |
| 4408 | Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) | 4402 | Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) |
| 4409 | { | 4403 | { |
| 4410 | Lisp_Object prop, overlay; | 4404 | Lisp_Object prop, overlay; |
| 4411 | struct Lisp_Overlay *tail; | 4405 | struct Lisp_Overlay *tail; |
| 4412 | /* 1 if this change is an insertion. */ | 4406 | /* True if this change is an insertion. */ |
| 4413 | int insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end)); | 4407 | bool insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end)); |
| 4414 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 4408 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 4415 | 4409 | ||
| 4416 | overlay = Qnil; | 4410 | overlay = Qnil; |
| @@ -4530,7 +4524,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, | |||
| 4530 | } | 4524 | } |
| 4531 | 4525 | ||
| 4532 | static void | 4526 | static void |
| 4533 | call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after, | 4527 | call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, bool after, |
| 4534 | Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) | 4528 | Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3) |
| 4535 | { | 4529 | { |
| 4536 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 4530 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| @@ -4689,7 +4683,7 @@ static int mmap_page_size; | |||
| 4689 | 4683 | ||
| 4690 | /* 1 means mmap has been initialized. */ | 4684 | /* 1 means mmap has been initialized. */ |
| 4691 | 4685 | ||
| 4692 | static int mmap_initialized_p; | 4686 | static bool mmap_initialized_p; |
| 4693 | 4687 | ||
| 4694 | /* Value is X rounded up to the next multiple of N. */ | 4688 | /* Value is X rounded up to the next multiple of N. */ |
| 4695 | 4689 | ||
| @@ -4785,9 +4779,9 @@ mmap_find (void *start, void *end) | |||
| 4785 | 4779 | ||
| 4786 | 4780 | ||
| 4787 | /* Unmap a region. P is a pointer to the start of the user-araa of | 4781 | /* Unmap a region. P is a pointer to the start of the user-araa of |
| 4788 | the region. Value is non-zero if successful. */ | 4782 | the region. */ |
| 4789 | 4783 | ||
| 4790 | static int | 4784 | static void |
| 4791 | mmap_free_1 (struct mmap_region *r) | 4785 | mmap_free_1 (struct mmap_region *r) |
| 4792 | { | 4786 | { |
| 4793 | if (r->next) | 4787 | if (r->next) |
| @@ -4798,24 +4792,19 @@ mmap_free_1 (struct mmap_region *r) | |||
| 4798 | mmap_regions = r->next; | 4792 | mmap_regions = r->next; |
| 4799 | 4793 | ||
| 4800 | if (munmap (r, r->nbytes_mapped) == -1) | 4794 | if (munmap (r, r->nbytes_mapped) == -1) |
| 4801 | { | 4795 | fprintf (stderr, "munmap: %s\n", emacs_strerror (errno)); |
| 4802 | fprintf (stderr, "munmap: %s\n", emacs_strerror (errno)); | ||
| 4803 | return 0; | ||
| 4804 | } | ||
| 4805 | |||
| 4806 | return 1; | ||
| 4807 | } | 4796 | } |
| 4808 | 4797 | ||
| 4809 | 4798 | ||
| 4810 | /* Enlarge region R by NPAGES pages. NPAGES < 0 means shrink R. | 4799 | /* Enlarge region R by NPAGES pages. NPAGES < 0 means shrink R. |
| 4811 | Value is non-zero if successful. */ | 4800 | Value is true if successful. */ |
| 4812 | 4801 | ||
| 4813 | static int | 4802 | static bool |
| 4814 | mmap_enlarge (struct mmap_region *r, int npages) | 4803 | mmap_enlarge (struct mmap_region *r, int npages) |
| 4815 | { | 4804 | { |
| 4816 | char *region_end = (char *) r + r->nbytes_mapped; | 4805 | char *region_end = (char *) r + r->nbytes_mapped; |
| 4817 | size_t nbytes; | 4806 | size_t nbytes; |
| 4818 | int success = 0; | 4807 | bool success = 0; |
| 4819 | 4808 | ||
| 4820 | if (npages < 0) | 4809 | if (npages < 0) |
| 4821 | { | 4810 | { |
| @@ -4865,17 +4854,16 @@ mmap_enlarge (struct mmap_region *r, int npages) | |||
| 4865 | } | 4854 | } |
| 4866 | 4855 | ||
| 4867 | 4856 | ||
| 4868 | /* Set or reset variables holding references to mapped regions. If | 4857 | /* Set or reset variables holding references to mapped regions. |
| 4869 | RESTORE_P is zero, set all variables to null. If RESTORE_P is | 4858 | If not RESTORE_P, set all variables to null. If RESTORE_P, set all |
| 4870 | non-zero, set all variables to the start of the user-areas | 4859 | variables to the start of the user-areas of mapped regions. |
| 4871 | of mapped regions. | ||
| 4872 | 4860 | ||
| 4873 | This function is called from Fdump_emacs to ensure that the dumped | 4861 | This function is called from Fdump_emacs to ensure that the dumped |
| 4874 | Emacs doesn't contain references to memory that won't be mapped | 4862 | Emacs doesn't contain references to memory that won't be mapped |
| 4875 | when Emacs starts. */ | 4863 | when Emacs starts. */ |
| 4876 | 4864 | ||
| 4877 | void | 4865 | void |
| 4878 | mmap_set_vars (int restore_p) | 4866 | mmap_set_vars (bool restore_p) |
| 4879 | { | 4867 | { |
| 4880 | struct mmap_region *r; | 4868 | struct mmap_region *r; |
| 4881 | 4869 | ||