emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109797: Fix usage of set_buffer_inte


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109797: Fix usage of set_buffer_internal.
Date: Tue, 28 Aug 2012 09:49:02 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109797
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2012-08-28 09:49:02 +0400
message:
  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.
modified:
  src/ChangeLog
  src/buffer.c
  src/buffer.h
  src/coding.c
  src/fileio.c
  src/fns.c
  src/insdel.c
  src/keyboard.c
  src/print.c
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-28 00:33:56 +0000
+++ b/src/ChangeLog     2012-08-28 05:49:02 +0000
@@ -1,3 +1,16 @@
+2012-08-28  Dmitry Antipov  <address@hidden>
+
+       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.
+
 2012-08-27  Paul Eggert  <address@hidden>
 
        * dispnew.c: Use bool for boolean.

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-08-24 04:37:57 +0000
+++ b/src/buffer.c      2012-08-28 05:49:02 +0000
@@ -2099,22 +2099,6 @@
   XSETBUFFER (buf, current_buffer);
   return buf;
 }
-
-/* Set the current buffer to B.
-
-   We previously set windows_or_buffers_changed here to invalidate
-   global unchanged information in beg_unchanged and end_unchanged.
-   This is no longer necessary because we now compute unchanged
-   information on a buffer-basis.  Every action affecting other
-   windows than the selected one requires a select_window at some
-   time, and that increments windows_or_buffers_changed.  */
-
-void
-set_buffer_internal (register struct buffer *b)
-{
-  if (current_buffer != b)
-    set_buffer_internal_1 (b);
-}
 
 /* Set the current buffer to B, and do not set windows_or_buffers_changed.
    This is used by redisplay.  */
@@ -2226,7 +2210,7 @@
 set_buffer_if_live (Lisp_Object buffer)
 {
   if (! NILP (BVAR (XBUFFER (buffer), name)))
-    Fset_buffer (buffer);
+    set_buffer_internal (XBUFFER (buffer));
   return Qnil;
 }
 

=== modified file 'src/buffer.h'
--- a/src/buffer.h      2012-08-24 04:37:57 +0000
+++ b/src/buffer.h      2012-08-28 05:49:02 +0000
@@ -1014,7 +1014,6 @@
 extern void recenter_overlay_lists (struct buffer *, ptrdiff_t);
 extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char 
**);
 extern void validate_region (Lisp_Object *, Lisp_Object *);
-extern void set_buffer_internal (struct buffer *);
 extern void set_buffer_internal_1 (struct buffer *);
 extern void set_buffer_temp (struct buffer *);
 extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object);
@@ -1023,6 +1022,22 @@
 extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t);
 extern void mmap_set_vars (bool);
 
+/* Set the current buffer to B.
+
+   We previously set windows_or_buffers_changed here to invalidate
+   global unchanged information in beg_unchanged and end_unchanged.
+   This is no longer necessary because we now compute unchanged
+   information on a buffer-basis.  Every action affecting other
+   windows than the selected one requires a select_window at some
+   time, and that increments windows_or_buffers_changed.  */
+
+BUFFER_INLINE void
+set_buffer_internal (struct buffer *b)
+{
+  if (current_buffer != b)
+    set_buffer_internal_1 (b);
+}
+
 /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
    If NEXTP is non-NULL, return next overlay there.
    See overlay_at arg CHANGE_REQ for meaning of CHRQ arg.  */

=== modified file 'src/coding.c'
--- a/src/coding.c      2012-08-27 16:19:34 +0000
+++ b/src/coding.c      2012-08-28 05:49:02 +0000
@@ -7006,8 +7006,7 @@
   undo_list = Qt;
   if (BUFFERP (coding->dst_object))
     {
-      if (current_buffer != XBUFFER (coding->dst_object))
-       set_buffer_internal (XBUFFER (coding->dst_object));
+      set_buffer_internal (XBUFFER (coding->dst_object));
       if (GPT != PT)
        move_gap_both (PT, PT_BYTE);
 

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2012-08-27 16:19:34 +0000
+++ b/src/fileio.c      2012-08-28 05:49:02 +0000
@@ -3142,8 +3142,7 @@
   undo_list = XCAR (unwind_data);
   buffer = XCDR (unwind_data);
 
-  if (current_buffer != XBUFFER (buffer))
-    set_buffer_internal (XBUFFER (buffer));
+  set_buffer_internal (XBUFFER (buffer));
   adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE);
   adjust_overlays_for_delete (BEG, Z - BEG);
   set_buffer_intervals (current_buffer, NULL);

=== modified file 'src/fns.c'
--- a/src/fns.c 2012-08-26 09:26:45 +0000
+++ b/src/fns.c 2012-08-28 05:49:02 +0000
@@ -4661,8 +4661,7 @@
       CHECK_BUFFER (object);
 
       bp = XBUFFER (object);
-      if (bp != current_buffer)
-       set_buffer_internal (bp);
+      set_buffer_internal (bp);
 
       if (NILP (start))
        b = BEGV;
@@ -4749,8 +4748,7 @@
        }
 
       object = make_buffer_string (b, e, 0);
-      if (prev != current_buffer)
-       set_buffer_internal (prev);
+      set_buffer_internal (prev);
       /* Discard the unwind protect for recovering the current
         buffer.  */
       specpdl_ptr--;

=== modified file 'src/insdel.c'
--- a/src/insdel.c      2012-08-18 06:06:39 +0000
+++ b/src/insdel.c      2012-08-28 05:49:02 +0000
@@ -1779,8 +1779,7 @@
 {
   struct buffer *old_buffer = current_buffer;
 
-  if (buffer != old_buffer)
-    set_buffer_internal (buffer);
+  set_buffer_internal (buffer);
 
   prepare_to_modify_buffer (start, end, NULL);
 
@@ -1794,8 +1793,7 @@
 
   bset_point_before_scroll (buffer, Qnil);
 
-  if (buffer != old_buffer)
-    set_buffer_internal (old_buffer);
+  set_buffer_internal (old_buffer);
 }
 
 /* Check that it is okay to modify the buffer between START and END,

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2012-08-23 08:33:56 +0000
+++ b/src/keyboard.c    2012-08-28 05:49:02 +0000
@@ -1434,8 +1434,7 @@
        Fkill_emacs (Qnil);
 
       /* Make sure the current window's buffer is selected.  */
-      if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
-       set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
+      set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
 
       /* Display any malloc warning that just came out.  Use while because
         displaying one warning can cause another.  */
@@ -1513,8 +1512,7 @@
       /* A filter may have run while we were reading the input.  */
       if (! FRAME_LIVE_P (XFRAME (selected_frame)))
        Fkill_emacs (Qnil);
-      if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
-       set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
+      set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
 
       ++num_input_keys;
 

=== modified file 'src/print.c'
--- a/src/print.c       2012-08-21 23:39:56 +0000
+++ b/src/print.c       2012-08-28 05:49:02 +0000
@@ -197,8 +197,7 @@
                               ? PT - start_point : 0),                 \
                  old_point_byte + (old_point_byte >= start_point_byte  \
                                    ? PT_BYTE - start_point_byte : 0)); \
-   if (old != current_buffer)                                          \
-     set_buffer_internal (old);
+   set_buffer_internal (old);
 
 #define PRINTCHAR(ch) printchar (ch, printcharfun)
 

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-08-28 00:33:56 +0000
+++ b/src/xdisp.c       2012-08-28 05:49:02 +0000
@@ -14551,8 +14551,7 @@
                            make_number (CHARPOS (startp)));
       SET_TEXT_POS_FROM_MARKER (startp, w->start);
       /* In case the hook functions switch buffers.  */
-      if (current_buffer != XBUFFER (w->buffer))
-       set_buffer_internal_1 (XBUFFER (w->buffer));
+      set_buffer_internal (XBUFFER (w->buffer));
     }
 
   return startp;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]