diff options
| author | Dmitry Antipov | 2012-08-28 09:49:02 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-08-28 09:49:02 +0400 |
| commit | a3d794a153425b09a0185c660926c241d13e0f2c (patch) | |
| tree | b6fed003f6109914b54a9077febeca444852ffa0 /src | |
| parent | 59ea14cde3090fe0bef42d646682b3801859be14 (diff) | |
| download | emacs-a3d794a153425b09a0185c660926c241d13e0f2c.tar.gz emacs-a3d794a153425b09a0185c660926c241d13e0f2c.zip | |
Fix usage of set_buffer_internal.
* buffer.h (set_buffer_internal): Make it BUFFER_INLINE.
* buffer.c (set_buffer_if_live): Use set_buffer_internal.
* coding.c (decode_coding): Omit redundant test.
* fileio.c (decide_coding_unwind): Likewise.
* fns.c (secure_hash): Likewise.
* insdel.c (modify_region): Likewise.
* keyboard.c (command_loop_1): Likewise.
* print.c (PRINTFINISH): Likewise.
* xdisp.c (run_window_scroll_functions): Use set_buffer_internal.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/buffer.c | 18 | ||||
| -rw-r--r-- | src/buffer.h | 17 | ||||
| -rw-r--r-- | src/coding.c | 3 | ||||
| -rw-r--r-- | src/fileio.c | 3 | ||||
| -rw-r--r-- | src/fns.c | 6 | ||||
| -rw-r--r-- | src/insdel.c | 6 | ||||
| -rw-r--r-- | src/keyboard.c | 6 | ||||
| -rw-r--r-- | src/print.c | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 3 |
10 files changed, 40 insertions, 38 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 531d20ffca0..0806cc0ff95 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2012-08-28 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Fix usage of set_buffer_internal. | ||
| 4 | * buffer.h (set_buffer_internal): Make it BUFFER_INLINE. | ||
| 5 | * buffer.c (set_buffer_if_live): Use set_buffer_internal. | ||
| 6 | * coding.c (decode_coding): Omit redundant test. | ||
| 7 | * fileio.c (decide_coding_unwind): Likewise. | ||
| 8 | * fns.c (secure_hash): Likewise. | ||
| 9 | * insdel.c (modify_region): Likewise. | ||
| 10 | * keyboard.c (command_loop_1): Likewise. | ||
| 11 | * print.c (PRINTFINISH): Likewise. | ||
| 12 | * xdisp.c (run_window_scroll_functions): Use set_buffer_internal. | ||
| 13 | |||
| 1 | 2012-08-27 Paul Eggert <eggert@cs.ucla.edu> | 14 | 2012-08-27 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 15 | ||
| 3 | * dispnew.c: Use bool for boolean. | 16 | * dispnew.c: Use bool for boolean. |
diff --git a/src/buffer.c b/src/buffer.c index 4d606c2105a..5185e6c89f1 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2099,22 +2099,6 @@ DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, | |||
| 2099 | XSETBUFFER (buf, current_buffer); | 2099 | XSETBUFFER (buf, current_buffer); |
| 2100 | return buf; | 2100 | return buf; |
| 2101 | } | 2101 | } |
| 2102 | |||
| 2103 | /* Set the current buffer to B. | ||
| 2104 | |||
| 2105 | We previously set windows_or_buffers_changed here to invalidate | ||
| 2106 | global unchanged information in beg_unchanged and end_unchanged. | ||
| 2107 | This is no longer necessary because we now compute unchanged | ||
| 2108 | information on a buffer-basis. Every action affecting other | ||
| 2109 | windows than the selected one requires a select_window at some | ||
| 2110 | time, and that increments windows_or_buffers_changed. */ | ||
| 2111 | |||
| 2112 | void | ||
| 2113 | set_buffer_internal (register struct buffer *b) | ||
| 2114 | { | ||
| 2115 | if (current_buffer != b) | ||
| 2116 | set_buffer_internal_1 (b); | ||
| 2117 | } | ||
| 2118 | 2102 | ||
| 2119 | /* Set the current buffer to B, and do not set windows_or_buffers_changed. | 2103 | /* Set the current buffer to B, and do not set windows_or_buffers_changed. |
| 2120 | This is used by redisplay. */ | 2104 | This is used by redisplay. */ |
| @@ -2226,7 +2210,7 @@ Lisp_Object | |||
| 2226 | set_buffer_if_live (Lisp_Object buffer) | 2210 | set_buffer_if_live (Lisp_Object buffer) |
| 2227 | { | 2211 | { |
| 2228 | if (! NILP (BVAR (XBUFFER (buffer), name))) | 2212 | if (! NILP (BVAR (XBUFFER (buffer), name))) |
| 2229 | Fset_buffer (buffer); | 2213 | set_buffer_internal (XBUFFER (buffer)); |
| 2230 | return Qnil; | 2214 | return Qnil; |
| 2231 | } | 2215 | } |
| 2232 | 2216 | ||
diff --git a/src/buffer.h b/src/buffer.h index c8b59ffde0b..929da3c4791 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -1014,7 +1014,6 @@ extern ptrdiff_t sort_overlays (Lisp_Object *, ptrdiff_t, struct window *); | |||
| 1014 | extern void recenter_overlay_lists (struct buffer *, ptrdiff_t); | 1014 | extern void recenter_overlay_lists (struct buffer *, ptrdiff_t); |
| 1015 | extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **); | 1015 | extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **); |
| 1016 | extern void validate_region (Lisp_Object *, Lisp_Object *); | 1016 | extern void validate_region (Lisp_Object *, Lisp_Object *); |
| 1017 | extern void set_buffer_internal (struct buffer *); | ||
| 1018 | extern void set_buffer_internal_1 (struct buffer *); | 1017 | extern void set_buffer_internal_1 (struct buffer *); |
| 1019 | extern void set_buffer_temp (struct buffer *); | 1018 | extern void set_buffer_temp (struct buffer *); |
| 1020 | extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object); | 1019 | extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object); |
| @@ -1023,6 +1022,22 @@ extern _Noreturn void buffer_slot_type_mismatch (Lisp_Object, int); | |||
| 1023 | extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); | 1022 | extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 1024 | extern void mmap_set_vars (bool); | 1023 | extern void mmap_set_vars (bool); |
| 1025 | 1024 | ||
| 1025 | /* Set the current buffer to B. | ||
| 1026 | |||
| 1027 | We previously set windows_or_buffers_changed here to invalidate | ||
| 1028 | global unchanged information in beg_unchanged and end_unchanged. | ||
| 1029 | This is no longer necessary because we now compute unchanged | ||
| 1030 | information on a buffer-basis. Every action affecting other | ||
| 1031 | windows than the selected one requires a select_window at some | ||
| 1032 | time, and that increments windows_or_buffers_changed. */ | ||
| 1033 | |||
| 1034 | BUFFER_INLINE void | ||
| 1035 | set_buffer_internal (struct buffer *b) | ||
| 1036 | { | ||
| 1037 | if (current_buffer != b) | ||
| 1038 | set_buffer_internal_1 (b); | ||
| 1039 | } | ||
| 1040 | |||
| 1026 | /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements. | 1041 | /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements. |
| 1027 | If NEXTP is non-NULL, return next overlay there. | 1042 | If NEXTP is non-NULL, return next overlay there. |
| 1028 | See overlay_at arg CHANGE_REQ for meaning of CHRQ arg. */ | 1043 | See overlay_at arg CHANGE_REQ for meaning of CHRQ arg. */ |
diff --git a/src/coding.c b/src/coding.c index 5bfd42c7272..02e7b34695e 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -7006,8 +7006,7 @@ decode_coding (struct coding_system *coding) | |||
| 7006 | undo_list = Qt; | 7006 | undo_list = Qt; |
| 7007 | if (BUFFERP (coding->dst_object)) | 7007 | if (BUFFERP (coding->dst_object)) |
| 7008 | { | 7008 | { |
| 7009 | if (current_buffer != XBUFFER (coding->dst_object)) | 7009 | set_buffer_internal (XBUFFER (coding->dst_object)); |
| 7010 | set_buffer_internal (XBUFFER (coding->dst_object)); | ||
| 7011 | if (GPT != PT) | 7010 | if (GPT != PT) |
| 7012 | move_gap_both (PT, PT_BYTE); | 7011 | move_gap_both (PT, PT_BYTE); |
| 7013 | 7012 | ||
diff --git a/src/fileio.c b/src/fileio.c index 6906af7e74f..44696cc8e62 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3142,8 +3142,7 @@ decide_coding_unwind (Lisp_Object unwind_data) | |||
| 3142 | undo_list = XCAR (unwind_data); | 3142 | undo_list = XCAR (unwind_data); |
| 3143 | buffer = XCDR (unwind_data); | 3143 | buffer = XCDR (unwind_data); |
| 3144 | 3144 | ||
| 3145 | if (current_buffer != XBUFFER (buffer)) | 3145 | set_buffer_internal (XBUFFER (buffer)); |
| 3146 | set_buffer_internal (XBUFFER (buffer)); | ||
| 3147 | adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE); | 3146 | adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE); |
| 3148 | adjust_overlays_for_delete (BEG, Z - BEG); | 3147 | adjust_overlays_for_delete (BEG, Z - BEG); |
| 3149 | set_buffer_intervals (current_buffer, NULL); | 3148 | set_buffer_intervals (current_buffer, NULL); |
| @@ -4661,8 +4661,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_ | |||
| 4661 | CHECK_BUFFER (object); | 4661 | CHECK_BUFFER (object); |
| 4662 | 4662 | ||
| 4663 | bp = XBUFFER (object); | 4663 | bp = XBUFFER (object); |
| 4664 | if (bp != current_buffer) | 4664 | set_buffer_internal (bp); |
| 4665 | set_buffer_internal (bp); | ||
| 4666 | 4665 | ||
| 4667 | if (NILP (start)) | 4666 | if (NILP (start)) |
| 4668 | b = BEGV; | 4667 | b = BEGV; |
| @@ -4749,8 +4748,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_ | |||
| 4749 | } | 4748 | } |
| 4750 | 4749 | ||
| 4751 | object = make_buffer_string (b, e, 0); | 4750 | object = make_buffer_string (b, e, 0); |
| 4752 | if (prev != current_buffer) | 4751 | set_buffer_internal (prev); |
| 4753 | set_buffer_internal (prev); | ||
| 4754 | /* Discard the unwind protect for recovering the current | 4752 | /* Discard the unwind protect for recovering the current |
| 4755 | buffer. */ | 4753 | buffer. */ |
| 4756 | specpdl_ptr--; | 4754 | specpdl_ptr--; |
diff --git a/src/insdel.c b/src/insdel.c index 1dceb67bffa..53a3a1370cd 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1779,8 +1779,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end, | |||
| 1779 | { | 1779 | { |
| 1780 | struct buffer *old_buffer = current_buffer; | 1780 | struct buffer *old_buffer = current_buffer; |
| 1781 | 1781 | ||
| 1782 | if (buffer != old_buffer) | 1782 | set_buffer_internal (buffer); |
| 1783 | set_buffer_internal (buffer); | ||
| 1784 | 1783 | ||
| 1785 | prepare_to_modify_buffer (start, end, NULL); | 1784 | prepare_to_modify_buffer (start, end, NULL); |
| 1786 | 1785 | ||
| @@ -1794,8 +1793,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end, | |||
| 1794 | 1793 | ||
| 1795 | bset_point_before_scroll (buffer, Qnil); | 1794 | bset_point_before_scroll (buffer, Qnil); |
| 1796 | 1795 | ||
| 1797 | if (buffer != old_buffer) | 1796 | set_buffer_internal (old_buffer); |
| 1798 | set_buffer_internal (old_buffer); | ||
| 1799 | } | 1797 | } |
| 1800 | 1798 | ||
| 1801 | /* Check that it is okay to modify the buffer between START and END, | 1799 | /* Check that it is okay to modify the buffer between START and END, |
diff --git a/src/keyboard.c b/src/keyboard.c index 3e0ead7e4fb..f31480e3b88 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1434,8 +1434,7 @@ command_loop_1 (void) | |||
| 1434 | Fkill_emacs (Qnil); | 1434 | Fkill_emacs (Qnil); |
| 1435 | 1435 | ||
| 1436 | /* Make sure the current window's buffer is selected. */ | 1436 | /* Make sure the current window's buffer is selected. */ |
| 1437 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | 1437 | set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); |
| 1438 | set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); | ||
| 1439 | 1438 | ||
| 1440 | /* Display any malloc warning that just came out. Use while because | 1439 | /* Display any malloc warning that just came out. Use while because |
| 1441 | displaying one warning can cause another. */ | 1440 | displaying one warning can cause another. */ |
| @@ -1513,8 +1512,7 @@ command_loop_1 (void) | |||
| 1513 | /* A filter may have run while we were reading the input. */ | 1512 | /* A filter may have run while we were reading the input. */ |
| 1514 | if (! FRAME_LIVE_P (XFRAME (selected_frame))) | 1513 | if (! FRAME_LIVE_P (XFRAME (selected_frame))) |
| 1515 | Fkill_emacs (Qnil); | 1514 | Fkill_emacs (Qnil); |
| 1516 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | 1515 | set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); |
| 1517 | set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); | ||
| 1518 | 1516 | ||
| 1519 | ++num_input_keys; | 1517 | ++num_input_keys; |
| 1520 | 1518 | ||
diff --git a/src/print.c b/src/print.c index 64449aeaf2a..36d0b5dce9d 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -197,8 +197,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1; | |||
| 197 | ? PT - start_point : 0), \ | 197 | ? PT - start_point : 0), \ |
| 198 | old_point_byte + (old_point_byte >= start_point_byte \ | 198 | old_point_byte + (old_point_byte >= start_point_byte \ |
| 199 | ? PT_BYTE - start_point_byte : 0)); \ | 199 | ? PT_BYTE - start_point_byte : 0)); \ |
| 200 | if (old != current_buffer) \ | 200 | set_buffer_internal (old); |
| 201 | set_buffer_internal (old); | ||
| 202 | 201 | ||
| 203 | #define PRINTCHAR(ch) printchar (ch, printcharfun) | 202 | #define PRINTCHAR(ch) printchar (ch, printcharfun) |
| 204 | 203 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 8289c003031..13b03736bde 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -14551,8 +14551,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp) | |||
| 14551 | make_number (CHARPOS (startp))); | 14551 | make_number (CHARPOS (startp))); |
| 14552 | SET_TEXT_POS_FROM_MARKER (startp, w->start); | 14552 | SET_TEXT_POS_FROM_MARKER (startp, w->start); |
| 14553 | /* In case the hook functions switch buffers. */ | 14553 | /* In case the hook functions switch buffers. */ |
| 14554 | if (current_buffer != XBUFFER (w->buffer)) | 14554 | set_buffer_internal (XBUFFER (w->buffer)); |
| 14555 | set_buffer_internal_1 (XBUFFER (w->buffer)); | ||
| 14556 | } | 14555 | } |
| 14557 | 14556 | ||
| 14558 | return startp; | 14557 | return startp; |