changeset 110545:6ae8bab9b79a

Fix int/EMACS_INT use in buffer.c. buffer.c (struct sortvec): Use EMACS_INT for buffer positions. (struct sortstrlist, overlay_str_len): Use EMACS_INT for string length. (advance_to_char_boundary, Fset_buffer_multibyte) (overlays_at, overlays_in, mouse_face_overlay_overlaps) (overlay_touches_p, record_overlay_string, overlay_strings) (recenter_overlay_lists, fix_start_end_in_overlays) (modify_overlay, Fmove_overlay, report_overlay_modification) (evaporate_overlays): Use EMACS_INT for buffer positions. lisp.h (fix_start_end_in_overlays, overlay_touches_p): Adjust prototypes.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 24 Sep 2010 08:45:09 -0400
parents bb46575a984d
children 446e46eafccb
files src/ChangeLog src/buffer.c src/lisp.h
diffstat 3 files changed, 62 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Sep 24 08:05:24 2010 -0400
+++ b/src/ChangeLog	Fri Sep 24 08:45:09 2010 -0400
@@ -1,5 +1,18 @@
 2010-09-24  Eli Zaretskii  <eliz@gnu.org>
 
+	* buffer.c (struct sortvec): Use EMACS_INT for buffer positions.
+	(struct sortstrlist, overlay_str_len): Use EMACS_INT for string
+	length.
+	(advance_to_char_boundary, Fset_buffer_multibyte)
+	(overlays_at, overlays_in, mouse_face_overlay_overlaps)
+	(overlay_touches_p, record_overlay_string, overlay_strings)
+	(recenter_overlay_lists, fix_start_end_in_overlays)
+	(modify_overlay, Fmove_overlay, report_overlay_modification)
+	(evaporate_overlays): Use EMACS_INT for buffer positions.
+
+	* lisp.h (fix_start_end_in_overlays, overlay_touches_p): Adjust
+	prototypes.
+
 	* dispextern.h (struct bidi_saved_info): Use EMACS_INT for buffer
 	positions.
 
--- a/src/buffer.c	Fri Sep 24 08:05:24 2010 -0400
+++ b/src/buffer.c	Fri Sep 24 08:45:09 2010 -0400
@@ -2092,7 +2092,7 @@
    and return the adjusted position.  */
 
 static int
-advance_to_char_boundary (int byte_pos)
+advance_to_char_boundary (EMACS_INT byte_pos)
 {
   int c;
 
@@ -2105,7 +2105,7 @@
     {
       /* We should advance BYTE_POS only when C is a constituent of a
          multibyte sequence.  */
-      int orig_byte_pos = byte_pos;
+      EMACS_INT orig_byte_pos = byte_pos;
 
       do
 	{
@@ -2273,7 +2273,7 @@
 {
   struct Lisp_Marker *tail, *markers;
   struct buffer *other;
-  int begv, zv;
+  EMACS_INT begv, zv;
   int narrowed = (BEG != BEGV || Z != ZV);
   int modified_p = !NILP (Fbuffer_modified_p (Qnil));
   Lisp_Object old_undo = current_buffer->undo_list;
@@ -2305,7 +2305,7 @@
 
   if (NILP (flag))
     {
-      int pos, stop;
+      EMACS_INT pos, stop;
       unsigned char *p;
 
       /* Do this first, so it can use CHAR_TO_BYTE
@@ -2369,8 +2369,8 @@
     }
   else
     {
-      int pt = PT;
-      int pos, stop;
+      EMACS_INT pt = PT;
+      EMACS_INT pos, stop;
       unsigned char *p, *pend;
 
       /* Be sure not to have a multibyte sequence striding over the GAP.
@@ -2386,7 +2386,7 @@
 	  while (! CHAR_HEAD_P (*p) && p > BEG_ADDR) p--;
 	  if (LEADING_CODE_P (*p))
 	    {
-	      int new_gpt = GPT_BYTE - (GPT_ADDR - p);
+	      EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - p);
 
 	      move_gap_both (new_gpt, new_gpt);
 	    }
@@ -2470,8 +2470,8 @@
 	ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG;
 
       {
-	int pt_byte = advance_to_char_boundary (PT_BYTE);
-	int pt;
+	EMACS_INT pt_byte = advance_to_char_boundary (PT_BYTE);
+	EMACS_INT pt;
 
 	if (pt_byte > GPT_BYTE)
 	  pt = chars_in_text (GAP_END_ADDR, pt_byte - GPT_BYTE) + GPT;
@@ -2642,13 +2642,13 @@
   int idx = 0;
   int len = *len_ptr;
   Lisp_Object *vec = *vec_ptr;
-  int next = ZV;
-  int prev = BEGV;
+  EMACS_INT next = ZV;
+  EMACS_INT prev = BEGV;
   int inhibit_storing = 0;
 
   for (tail = current_buffer->overlays_before; tail; tail = tail->next)
     {
-      int startpos, endpos;
+      EMACS_INT startpos, endpos;
 
       XSETMISC (overlay, tail);
 
@@ -2699,7 +2699,7 @@
 
   for (tail = current_buffer->overlays_after; tail; tail = tail->next)
     {
-      int startpos, endpos;
+      EMACS_INT startpos, endpos;
 
       XSETMISC (overlay, tail);
 
@@ -2773,22 +2773,23 @@
    But we still return the total number of overlays.  */
 
 static int
-overlays_in (int beg, int end, int extend, Lisp_Object **vec_ptr, int *len_ptr,
-	     int *next_ptr, int *prev_ptr)
+overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
+	     Lisp_Object **vec_ptr, int *len_ptr,
+	     EMACS_INT *next_ptr, EMACS_INT *prev_ptr)
 {
   Lisp_Object overlay, ostart, oend;
   struct Lisp_Overlay *tail;
   int idx = 0;
   int len = *len_ptr;
   Lisp_Object *vec = *vec_ptr;
-  int next = ZV;
-  int prev = BEGV;
+  EMACS_INT next = ZV;
+  EMACS_INT prev = BEGV;
   int inhibit_storing = 0;
   int end_is_Z = end == Z;
 
   for (tail = current_buffer->overlays_before; tail; tail = tail->next)
     {
-      int startpos, endpos;
+      EMACS_INT startpos, endpos;
 
       XSETMISC (overlay, tail);
 
@@ -2838,7 +2839,7 @@
 
   for (tail = current_buffer->overlays_after; tail; tail = tail->next)
     {
-      int startpos, endpos;
+      EMACS_INT startpos, endpos;
 
       XSETMISC (overlay, tail);
 
@@ -2897,8 +2898,8 @@
 int
 mouse_face_overlay_overlaps (Lisp_Object overlay)
 {
-  int start = OVERLAY_POSITION (OVERLAY_START (overlay));
-  int end = OVERLAY_POSITION (OVERLAY_END (overlay));
+  EMACS_INT start = OVERLAY_POSITION (OVERLAY_START (overlay));
+  EMACS_INT end = OVERLAY_POSITION (OVERLAY_END (overlay));
   int n, i, size;
   Lisp_Object *v, tem;
 
@@ -2924,14 +2925,14 @@
 
 /* Fast function to just test if we're at an overlay boundary.  */
 int
-overlay_touches_p (int pos)
+overlay_touches_p (EMACS_INT pos)
 {
   Lisp_Object overlay;
   struct Lisp_Overlay *tail;
 
   for (tail = current_buffer->overlays_before; tail; tail = tail->next)
     {
-      int endpos;
+      EMACS_INT endpos;
 
       XSETMISC (overlay ,tail);
       if (!OVERLAYP (overlay))
@@ -2946,7 +2947,7 @@
 
   for (tail = current_buffer->overlays_after; tail; tail = tail->next)
     {
-      int startpos;
+      EMACS_INT startpos;
 
       XSETMISC (overlay, tail);
       if (!OVERLAYP (overlay))
@@ -2964,7 +2965,7 @@
 struct sortvec
 {
   Lisp_Object overlay;
-  int beg, end;
+  EMACS_INT beg, end;
   int priority;
 };
 
@@ -3051,7 +3052,7 @@
   struct sortstr *buf;	/* An array that expands as needed; never freed.  */
   int size;		/* Allocated length of that array.  */
   int used;		/* How much of the array is currently in use.  */
-  int bytes;		/* Total length of the strings in buf.  */
+  EMACS_INT bytes;		/* Total length of the strings in buf.  */
 };
 
 /* Buffers for storing information about the overlays touching a given
@@ -3062,7 +3063,7 @@
 static unsigned char *overlay_str_buf;
 
 /* Allocated length of overlay_str_buf.  */
-static int overlay_str_len;
+static EMACS_INT overlay_str_len;
 
 /* A comparison function suitable for passing to qsort.  */
 static int
@@ -3080,7 +3081,7 @@
 static void
 record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str2, Lisp_Object pri, int size)
 {
-  int nbytes;
+  EMACS_INT nbytes;
 
   if (ssl->used == ssl->size)
     {
@@ -3138,7 +3139,7 @@
 {
   Lisp_Object overlay, window, str;
   struct Lisp_Overlay *ov;
-  int startpos, endpos;
+  EMACS_INT startpos, endpos;
   int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
 
   overlay_heads.used = overlay_heads.bytes = 0;
@@ -3208,9 +3209,9 @@
   if (overlay_heads.bytes || overlay_tails.bytes)
     {
       Lisp_Object tem;
-      int i;
+      EMACS_INT i;
       unsigned char *p;
-      int total = overlay_heads.bytes + overlay_tails.bytes;
+      EMACS_INT total = overlay_heads.bytes + overlay_tails.bytes;
 
       if (total > overlay_str_len)
 	{
@@ -3221,7 +3222,7 @@
       p = overlay_str_buf;
       for (i = overlay_tails.used; --i >= 0;)
 	{
-	  int nbytes;
+	  EMACS_INT nbytes;
 	  tem = overlay_tails.buf[i].string;
 	  nbytes = copy_text (SDATA (tem), p,
 			      SBYTES (tem),
@@ -3230,7 +3231,7 @@
 	}
       for (i = 0; i < overlay_heads.used; ++i)
 	{
-	  int nbytes;
+	  EMACS_INT nbytes;
 	  tem = overlay_heads.buf[i].string;
 	  nbytes = copy_text (SDATA (tem), p,
 			      SBYTES (tem),
@@ -3295,7 +3296,7 @@
       if (OVERLAY_POSITION (end) > pos)
 	{
 	  /* OVERLAY needs to be moved.  */
-	  int where = OVERLAY_POSITION (beg);
+	  EMACS_INT where = OVERLAY_POSITION (beg);
 	  struct Lisp_Overlay *other, *other_prev;
 
 	  /* Splice the cons cell TAIL out of overlays_before.  */
@@ -3368,7 +3369,7 @@
       if (OVERLAY_POSITION (end) <= pos)
 	{
 	  /* OVERLAY needs to be moved.  */
-	  int where = OVERLAY_POSITION (end);
+	  EMACS_INT where = OVERLAY_POSITION (end);
 	  struct Lisp_Overlay *other, *other_prev;
 
 	  /* Splice the cons cell TAIL out of overlays_after.  */
@@ -3440,7 +3441,7 @@
    Such an overlay might even have negative size at this point.
    If so, we'll make the overlay empty. */
 void
-fix_start_end_in_overlays (register int start, register int end)
+fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end)
 {
   Lisp_Object overlay;
   struct Lisp_Overlay *before_list, *after_list;
@@ -3452,7 +3453,7 @@
      current_buffer->overlays_before or overlays_after, depending
      which loop we're in.  */
   struct Lisp_Overlay *tail, *parent;
-  int startpos, endpos;
+  EMACS_INT startpos, endpos;
 
   /* This algorithm shifts links around instead of consing and GCing.
      The loop invariant is that before_list (resp. after_list) is a
@@ -3753,7 +3754,7 @@
 {
   if (start > end)
     {
-      int temp = start;
+      EMACS_INT temp = start;
       start = end;
       end = temp;
     }
@@ -3844,8 +3845,8 @@
       /* Redisplay where the overlay was.  */
       if (!NILP (obuffer))
 	{
-	  int o_beg;
-	  int o_end;
+	  EMACS_INT o_beg;
+	  EMACS_INT o_end;
 
 	  o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
 	  o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
@@ -3859,7 +3860,7 @@
   else
     /* Redisplay the area the overlay has just left, or just enclosed.  */
     {
-      int o_beg, o_end;
+      EMACS_INT o_beg, o_end;
 
       o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
       o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
@@ -4037,7 +4038,7 @@
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.  */
   noverlays = overlays_in (XINT (beg), XINT (end), 1, &overlay_vec, &len,
-			   (int *) 0, (int *) 0);
+			   NULL, NULL);
 
   /* Make a list of them all.  */
   result = Flist (noverlays, overlay_vec);
@@ -4280,7 +4281,7 @@
       last_overlay_modification_hooks_used = 0;
       for (tail = current_buffer->overlays_before; tail; tail = tail->next)
 	{
-	  int startpos, endpos;
+	  EMACS_INT startpos, endpos;
 	  Lisp_Object ostart, oend;
 
 	  XSETMISC (overlay, tail);
@@ -4317,7 +4318,7 @@
 
       for (tail = current_buffer->overlays_after; tail; tail = tail->next)
 	{
-	  int startpos, endpos;
+	  EMACS_INT startpos, endpos;
 	  Lisp_Object ostart, oend;
 
 	  XSETMISC (overlay, tail);
@@ -4409,7 +4410,7 @@
   if (pos <= current_buffer->overlay_center)
     for (tail = current_buffer->overlays_before; tail; tail = tail->next)
       {
-	int endpos;
+	EMACS_INT endpos;
 	XSETMISC (overlay, tail);
 	endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
 	if (endpos < pos)
@@ -4421,7 +4422,7 @@
   else
     for (tail = current_buffer->overlays_after; tail; tail = tail->next)
       {
-	int startpos;
+	EMACS_INT startpos;
 	XSETMISC (overlay, tail);
 	startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
 	if (startpos > pos)
--- a/src/lisp.h	Fri Sep 24 08:05:24 2010 -0400
+++ b/src/lisp.h	Fri Sep 24 08:45:09 2010 -0400
@@ -3015,10 +3015,10 @@
 EXFUN (Foverlay_buffer, 1);
 extern void adjust_overlays_for_insert (EMACS_INT, EMACS_INT);
 extern void adjust_overlays_for_delete (EMACS_INT, EMACS_INT);
-extern void fix_start_end_in_overlays (int, int);
+extern void fix_start_end_in_overlays (EMACS_INT, EMACS_INT);
 extern void report_overlay_modification (Lisp_Object, Lisp_Object, int,
                                          Lisp_Object, Lisp_Object, Lisp_Object);
-extern int overlay_touches_p (int);
+extern int overlay_touches_p (EMACS_INT);
 extern Lisp_Object Vbuffer_alist, Vinhibit_read_only;
 EXFUN (Fbuffer_list, 1);
 EXFUN (Fget_buffer, 1);