changeset 84951:55a892948dea

* indent.h: * indent.c: Use EMACS_INT for ints coming from Elisp data.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 27 Sep 2007 18:49:57 +0000
parents 07824eca67a8
children fd8f746ce48f
files src/ChangeLog src/indent.c src/indent.h src/xdisp.c
diffstat 4 files changed, 75 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Sep 27 18:27:48 2007 +0000
+++ b/src/ChangeLog	Thu Sep 27 18:49:57 2007 +0000
@@ -1,5 +1,8 @@
 2007-09-27  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* indent.h:
+	* indent.c: Use EMACS_INT for ints coming from Elisp data.
+
 	* indent.c (Fmove_to_column): Use EMACS_INT for buffer positions.
 
 2007-09-25  Jason Rumney  <jasonr@gnu.org>
--- a/src/indent.c	Thu Sep 27 18:27:48 2007 +0000
+++ b/src/indent.c	Thu Sep 27 18:49:57 2007 +0000
@@ -53,7 +53,7 @@
 
 /* Value of point when current_column was called.  */
 
-int last_known_column_point;
+EMACS_INT last_known_column_point;
 
 /* Value of MODIFF when current_column was called.  */
 
@@ -65,7 +65,7 @@
 /* Cache of beginning of line found by the last call of
    current_column. */
 
-int current_column_bol_cache;
+static EMACS_INT current_column_bol_cache;
 
 /* Get the display table to use for the current buffer.  */
 
@@ -214,16 +214,17 @@
    characters immediately following, then *NEXT_BOUNDARY_P
    will equal the return value.  */
 
-int
+EMACS_INT
 skip_invisible (pos, next_boundary_p, to, window)
-     int pos;
-     int *next_boundary_p;
-     int to;
+     EMACS_INT pos;
+     EMACS_INT *next_boundary_p;
+     EMACS_INT to;
      Lisp_Object window;
 {
   Lisp_Object prop, position, overlay_limit, proplimit;
   Lisp_Object buffer, tmp;
-  int end, inv_p;
+  EMACS_INT end;
+  int inv_p;
 
   XSETFASTINT (position, pos);
   XSETBUFFER (buffer, current_buffer);
@@ -510,16 +511,16 @@
 static double
 current_column_1 ()
 {
-  register int tab_width = XINT (current_buffer->tab_width);
+  register EMACS_INT tab_width = XINT (current_buffer->tab_width);
   register int ctl_arrow = !NILP (current_buffer->ctl_arrow);
   register struct Lisp_Char_Table *dp = buffer_display_table ();
   int multibyte = !NILP (current_buffer->enable_multibyte_characters);
 
   /* Start the scan at the beginning of this line with column number 0.  */
-  register int col = 0;
-  int scan, scan_byte;
-  int next_boundary;
-  int opoint = PT, opoint_byte = PT_BYTE;
+  register EMACS_INT col = 0;
+  EMACS_INT scan, scan_byte;
+  EMACS_INT next_boundary;
+  EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
 
   scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1);
   current_column_bol_cache = PT;
@@ -808,13 +809,13 @@
 position_indentation (pos_byte)
      register int pos_byte;
 {
-  register int column = 0;
-  register int tab_width = XINT (current_buffer->tab_width);
+  register EMACS_INT column = 0;
+  register EMACS_INT tab_width = XINT (current_buffer->tab_width);
   register unsigned char *p;
   register unsigned char *stop;
   unsigned char *start;
-  int next_boundary_byte = pos_byte;
-  int ceiling = next_boundary_byte;
+  EMACS_INT next_boundary_byte = pos_byte;
+  EMACS_INT ceiling = next_boundary_byte;
 
   if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
 
@@ -829,7 +830,7 @@
     {
       while (p == stop)
 	{
-	  int stop_pos_byte;
+	  EMACS_INT stop_pos_byte;
 
 	  /* If we have updated P, set POS_BYTE to match.
 	     The first time we enter the loop, POS_BYTE is already right.  */
@@ -840,8 +841,8 @@
 	    return column;
 	  if (pos_byte == next_boundary_byte)
 	    {
-	      int next_boundary;
-	      int pos = BYTE_TO_CHAR (pos_byte);
+	      EMACS_INT next_boundary;
+	      EMACS_INT pos = BYTE_TO_CHAR (pos_byte);
 	      pos = skip_invisible (pos, &next_boundary, ZV, Qnil);
 	      pos_byte = CHAR_TO_BYTE (pos);
 	      next_boundary_byte = CHAR_TO_BYTE (next_boundary);
@@ -1190,19 +1191,19 @@
 
 struct position *
 compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, hscroll, tab_offset, win)
-     int from, fromvpos, fromhpos, to, tovpos, tohpos;
-     int did_motion;
-     register int width;
-     int hscroll, tab_offset;
+     EMACS_INT from, fromvpos, fromhpos, to, tovpos, tohpos;
+     EMACS_INT did_motion;
+     EMACS_INT width;
+     EMACS_INT hscroll, tab_offset;
      struct window *win;
 {
-  register int hpos = fromhpos;
-  register int vpos = fromvpos;
+  register EMACS_INT hpos = fromhpos;
+  register EMACS_INT vpos = fromvpos;
 
-  register int pos;
-  int pos_byte;
+  register EMACS_INT pos;
+  EMACS_INT pos_byte;
   register int c = 0;
-  register int tab_width = XFASTINT (current_buffer->tab_width);
+  register EMACS_INT tab_width = XFASTINT (current_buffer->tab_width);
   register int ctl_arrow = !NILP (current_buffer->ctl_arrow);
   register struct Lisp_Char_Table *dp = window_display_table (win);
   int selective
@@ -1214,33 +1215,33 @@
        ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0);
   /* The next location where the `invisible' property changes, or an
      overlay starts or ends.  */
-  int next_boundary = from;
+  EMACS_INT next_boundary = from;
 
   /* For computing runs of characters with similar widths.
      Invariant: width_run_width is zero, or all the characters
      from width_run_start to width_run_end have a fixed width of
      width_run_width.  */
-  int width_run_start = from;
-  int width_run_end   = from;
-  int width_run_width = 0;
+  EMACS_INT width_run_start = from;
+  EMACS_INT width_run_end   = from;
+  EMACS_INT width_run_width = 0;
   Lisp_Object *width_table;
   Lisp_Object buffer;
 
   /* The next buffer pos where we should consult the width run cache. */
-  int next_width_run = from;
+  EMACS_INT next_width_run = from;
   Lisp_Object window;
 
   int multibyte = !NILP (current_buffer->enable_multibyte_characters);
   /* If previous char scanned was a wide character,
      this is the column where it ended.  Otherwise, this is 0.  */
-  int wide_column_end_hpos = 0;
-  int prev_pos;			/* Previous buffer position.  */
-  int prev_pos_byte;		/* Previous buffer position.  */
-  int prev_hpos = 0;
-  int prev_vpos = 0;
-  int contin_hpos;		/* HPOS of last column of continued line.  */
-  int prev_tab_offset;		/* Previous tab offset.  */
-  int continuation_glyph_width;
+  EMACS_INT wide_column_end_hpos = 0;
+  EMACS_INT prev_pos;		/* Previous buffer position.  */
+  EMACS_INT prev_pos_byte;	/* Previous buffer position.  */
+  EMACS_INT prev_hpos = 0;
+  EMACS_INT prev_vpos = 0;
+  EMACS_INT contin_hpos;	/* HPOS of last column of continued line.  */
+  EMACS_INT prev_tab_offset;	/* Previous tab offset.  */
+  EMACS_INT continuation_glyph_width;
 
   XSETBUFFER (buffer, current_buffer);
   XSETWINDOW (window, win);
@@ -1286,8 +1287,8 @@
     {
       while (pos == next_boundary)
 	{
-	  int pos_here = pos;
-	  int newpos;
+	  EMACS_INT pos_here = pos;
+	  EMACS_INT newpos;
 
 	  /* Don't skip invisible if we are already at the margin.  */
 	  if (vpos > tovpos || (vpos == tovpos && hpos >= tohpos))
@@ -1885,23 +1886,23 @@
 
 struct position *
 vmotion (from, vtarget, w)
-     register int from, vtarget;
+     register EMACS_INT from, vtarget;
      struct window *w;
 {
-  int hscroll = XINT (w->hscroll);
+  EMACS_INT hscroll = XINT (w->hscroll);
   struct position pos;
   /* vpos is cumulative vertical position, changed as from is changed */
   register int vpos = 0;
-  int prevline;
-  register int first;
-  int from_byte;
-  int lmargin = hscroll > 0 ? 1 - hscroll : 0;
+  EMACS_INT prevline;
+  register EMACS_INT first;
+  EMACS_INT from_byte;
+  EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0;
   int selective
     = (INTEGERP (current_buffer->selective_display)
        ? XINT (current_buffer->selective_display)
        : !NILP (current_buffer->selective_display) ? -1 : 0);
   Lisp_Object window;
-  int start_hpos = 0;
+  EMACS_INT start_hpos = 0;
   int did_motion;
   /* This is the object we use for fetching character properties.  */
   Lisp_Object text_prop_object;
--- a/src/indent.h	Thu Sep 27 18:27:48 2007 +0000
+++ b/src/indent.h	Thu Sep 27 18:49:57 2007 +0000
@@ -39,25 +39,31 @@
 
 struct position
   {
-    int bufpos;
-    int bytepos;
-    int hpos;
-    int vpos;
-    int prevhpos;
-    int contin;
+    EMACS_INT bufpos;
+    EMACS_INT bytepos;
+    EMACS_INT hpos;
+    EMACS_INT vpos;
+    EMACS_INT prevhpos;
+    EMACS_INT contin;
     /* Number of characters we have already handled
        from the before and after strings at this position.  */
-    int ovstring_chars_done;
-    int tab_offset;
+    EMACS_INT ovstring_chars_done;
+    EMACS_INT tab_offset;
   };
 
-struct position *compute_motion P_ ((int, int, int, int, int, int, int,
-				     int, int, int, struct window *));
-struct position *vmotion P_ ((int, int, struct window *));
-int skip_invisible P_ ((int, int *, int, Lisp_Object));
+struct position *compute_motion P_ ((EMACS_INT from, EMACS_INT fromvpos,
+				     EMACS_INT fromhpos, int did_motion,
+				     EMACS_INT to, EMACS_INT tovpos,
+				     EMACS_INT tohpos,
+				     EMACS_INT width, EMACS_INT hscroll,
+				     EMACS_INT tab_offset, struct window *));
+struct position *vmotion P_ ((EMACS_INT from, EMACS_INT vtarget,
+			      struct window *));
+EMACS_INT skip_invisible P_ ((EMACS_INT pos, EMACS_INT *next_boundary_p,
+			      EMACS_INT to, Lisp_Object window));
 
 /* Value of point when current_column was called */
-extern int last_known_column_point;
+extern EMACS_INT last_known_column_point;
 
 /* Functions for dealing with the column cache.  */
 
--- a/src/xdisp.c	Thu Sep 27 18:27:48 2007 +0000
+++ b/src/xdisp.c	Thu Sep 27 18:49:57 2007 +0000
@@ -3609,7 +3609,8 @@
     }
   else
     {
-      int invis_p, newpos, next_stop, start_charpos;
+      int invis_p;
+      EMACS_INT newpos, next_stop, start_charpos;
       Lisp_Object pos, prop, overlay;
 
       /* First of all, is there invisible text at this position?  */