]> code.delx.au - gnu-emacs/blobdiff - src/scroll.c
Sync x-server-* and x-display-* functions on NS with those on X11.
[gnu-emacs] / src / scroll.c
index 86d775545b0330d04c5a368b2f0e96c6a121b920..037e338c696a7804514e655b20c6938ad093a8bf 100644 (file)
@@ -1,7 +1,7 @@
 /* Calculate what line insertion or deletion to do, and do it
 
-Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2012
-  Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2013 Free Software
+Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -21,7 +21,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <stdio.h>
-#include <setjmp.h>
+
 #include "lisp.h"
 #include "termchar.h"
 #include "dispextern.h"
@@ -195,13 +195,13 @@ calculate_scrolling (FRAME_PTR frame,
          {
            cost = p1->writecost + first_insert_cost[i];
            if ((int) p1->insertcount > i)
-             abort ();
+             emacs_abort ();
            cost1 = p1->insertcost + next_insert_cost[i - p1->insertcount];
          }
        p->insertcost = min (cost, cost1) + draw_cost[i] + extra_cost;
        p->insertcount = (cost < cost1) ? 1 : p1->insertcount + 1;
        if ((int) p->insertcount > i)
-         abort ();
+         emacs_abort ();
 
        /* Calculate the cost if we do a delete line after
           outputting this line.
@@ -246,18 +246,17 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
   struct matrix_elt *p;
   int i, j, k;
 
-  /* Set to 1 if we have set a terminal window with
-     set_terminal_window.  It's unsigned to work around GCC bug 48228.  */
-  unsigned int terminal_window_p = 0;
+  /* True if we have set a terminal window with set_terminal_window.  */
+  bool terminal_window_p = 0;
 
   /* A queue for line insertions to be done.  */
   struct queue { int count, pos; };
   struct queue *queue_start
-    = (struct queue *) alloca (current_matrix->nrows * sizeof (struct queue));
+    = alloca (current_matrix->nrows * sizeof *queue_start);
   struct queue *queue = queue_start;
 
-  char *retained_p = (char *) alloca (window_size * sizeof (char));
-  int *copy_from = (int *) alloca (window_size * sizeof (int));
+  char *retained_p = alloca (window_size * sizeof *retained_p);
+  int *copy_from = alloca (window_size * sizeof *copy_from);
 
   /* Zero means line is empty.  */
   memset (retained_p, 0, window_size * sizeof (char));
@@ -657,25 +656,23 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
     alloca (window_size * sizeof *queue_start);
   struct alt_queue *queue = queue_start;
 
-  /* Set to 1 if a terminal window has been set with
-     set_terminal_window: */
-  int terminal_window_p = 0;
+  /* True if a terminal window has been set with set_terminal_window.  */
+  bool terminal_window_p = 0;
 
-  /* A nonzero value of write_follows indicates that a write has been
-     selected, allowing either an insert or a delete to be selected
-     next.  When write_follows is zero, a delete cannot be selected
+  /* If true, a write has been selected, allowing either an insert or a
+     delete to be selected next.  If false, a delete cannot be selected
      unless j < i, and an insert cannot be selected unless i < j.
      This corresponds to a similar restriction (with the ordering
      reversed) in calculate_direct_scrolling, which is intended to
      ensure that lines marked as inserted will be blank. */
-  int write_follows_p = 1;
+  bool write_follows_p = 1;
 
   /* For each row in the new matrix what row of the old matrix it is.  */
-  int *copy_from = (int *) alloca (window_size * sizeof (int));
+  int *copy_from = alloca (window_size * sizeof *copy_from);
 
   /* Non-zero for each row in the new matrix that is retained from the
      old matrix.  Lines not retained are empty.  */
-  char *retained_p = (char *) alloca (window_size * sizeof (char));
+  char *retained_p = alloca (window_size * sizeof *retained_p);
 
   memset (retained_p, 0, window_size * sizeof (char));