comparison src/buffer.c @ 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 4d54e23aa31e
children e49fcbdc458f
comparison
equal deleted inserted replaced
110544:bb46575a984d 110545:6ae8bab9b79a
2090 2090
2091 /* Advance BYTE_POS up to a character boundary 2091 /* Advance BYTE_POS up to a character boundary
2092 and return the adjusted position. */ 2092 and return the adjusted position. */
2093 2093
2094 static int 2094 static int
2095 advance_to_char_boundary (int byte_pos) 2095 advance_to_char_boundary (EMACS_INT byte_pos)
2096 { 2096 {
2097 int c; 2097 int c;
2098 2098
2099 if (byte_pos == BEG) 2099 if (byte_pos == BEG)
2100 /* Beginning of buffer is always a character boundary. */ 2100 /* Beginning of buffer is always a character boundary. */
2103 c = FETCH_BYTE (byte_pos); 2103 c = FETCH_BYTE (byte_pos);
2104 if (! CHAR_HEAD_P (c)) 2104 if (! CHAR_HEAD_P (c))
2105 { 2105 {
2106 /* We should advance BYTE_POS only when C is a constituent of a 2106 /* We should advance BYTE_POS only when C is a constituent of a
2107 multibyte sequence. */ 2107 multibyte sequence. */
2108 int orig_byte_pos = byte_pos; 2108 EMACS_INT orig_byte_pos = byte_pos;
2109 2109
2110 do 2110 do
2111 { 2111 {
2112 byte_pos--; 2112 byte_pos--;
2113 c = FETCH_BYTE (byte_pos); 2113 c = FETCH_BYTE (byte_pos);
2271 current buffer is cleared. */) 2271 current buffer is cleared. */)
2272 (Lisp_Object flag) 2272 (Lisp_Object flag)
2273 { 2273 {
2274 struct Lisp_Marker *tail, *markers; 2274 struct Lisp_Marker *tail, *markers;
2275 struct buffer *other; 2275 struct buffer *other;
2276 int begv, zv; 2276 EMACS_INT begv, zv;
2277 int narrowed = (BEG != BEGV || Z != ZV); 2277 int narrowed = (BEG != BEGV || Z != ZV);
2278 int modified_p = !NILP (Fbuffer_modified_p (Qnil)); 2278 int modified_p = !NILP (Fbuffer_modified_p (Qnil));
2279 Lisp_Object old_undo = current_buffer->undo_list; 2279 Lisp_Object old_undo = current_buffer->undo_list;
2280 struct gcpro gcpro1; 2280 struct gcpro gcpro1;
2281 2281
2303 if (narrowed) 2303 if (narrowed)
2304 Fwiden (); 2304 Fwiden ();
2305 2305
2306 if (NILP (flag)) 2306 if (NILP (flag))
2307 { 2307 {
2308 int pos, stop; 2308 EMACS_INT pos, stop;
2309 unsigned char *p; 2309 unsigned char *p;
2310 2310
2311 /* Do this first, so it can use CHAR_TO_BYTE 2311 /* Do this first, so it can use CHAR_TO_BYTE
2312 to calculate the old correspondences. */ 2312 to calculate the old correspondences. */
2313 set_intervals_multibyte (0); 2313 set_intervals_multibyte (0);
2367 if (narrowed) 2367 if (narrowed)
2368 Fnarrow_to_region (make_number (begv), make_number (zv)); 2368 Fnarrow_to_region (make_number (begv), make_number (zv));
2369 } 2369 }
2370 else 2370 else
2371 { 2371 {
2372 int pt = PT; 2372 EMACS_INT pt = PT;
2373 int pos, stop; 2373 EMACS_INT pos, stop;
2374 unsigned char *p, *pend; 2374 unsigned char *p, *pend;
2375 2375
2376 /* Be sure not to have a multibyte sequence striding over the GAP. 2376 /* Be sure not to have a multibyte sequence striding over the GAP.
2377 Ex: We change this: "...abc\302 _GAP_ \241def..." 2377 Ex: We change this: "...abc\302 _GAP_ \241def..."
2378 to: "...abc _GAP_ \302\241def..." */ 2378 to: "...abc _GAP_ \302\241def..." */
2384 unsigned char *p = GPT_ADDR - 1; 2384 unsigned char *p = GPT_ADDR - 1;
2385 2385
2386 while (! CHAR_HEAD_P (*p) && p > BEG_ADDR) p--; 2386 while (! CHAR_HEAD_P (*p) && p > BEG_ADDR) p--;
2387 if (LEADING_CODE_P (*p)) 2387 if (LEADING_CODE_P (*p))
2388 { 2388 {
2389 int new_gpt = GPT_BYTE - (GPT_ADDR - p); 2389 EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - p);
2390 2390
2391 move_gap_both (new_gpt, new_gpt); 2391 move_gap_both (new_gpt, new_gpt);
2392 } 2392 }
2393 } 2393 }
2394 2394
2468 ZV = chars_in_text (GAP_END_ADDR, ZV_BYTE - GPT_BYTE) + GPT; 2468 ZV = chars_in_text (GAP_END_ADDR, ZV_BYTE - GPT_BYTE) + GPT;
2469 else 2469 else
2470 ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; 2470 ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG;
2471 2471
2472 { 2472 {
2473 int pt_byte = advance_to_char_boundary (PT_BYTE); 2473 EMACS_INT pt_byte = advance_to_char_boundary (PT_BYTE);
2474 int pt; 2474 EMACS_INT pt;
2475 2475
2476 if (pt_byte > GPT_BYTE) 2476 if (pt_byte > GPT_BYTE)
2477 pt = chars_in_text (GAP_END_ADDR, pt_byte - GPT_BYTE) + GPT; 2477 pt = chars_in_text (GAP_END_ADDR, pt_byte - GPT_BYTE) + GPT;
2478 else 2478 else
2479 pt = chars_in_text (BEG_ADDR, pt_byte - BEG_BYTE) + BEG; 2479 pt = chars_in_text (BEG_ADDR, pt_byte - BEG_BYTE) + BEG;
2640 Lisp_Object overlay, start, end; 2640 Lisp_Object overlay, start, end;
2641 struct Lisp_Overlay *tail; 2641 struct Lisp_Overlay *tail;
2642 int idx = 0; 2642 int idx = 0;
2643 int len = *len_ptr; 2643 int len = *len_ptr;
2644 Lisp_Object *vec = *vec_ptr; 2644 Lisp_Object *vec = *vec_ptr;
2645 int next = ZV; 2645 EMACS_INT next = ZV;
2646 int prev = BEGV; 2646 EMACS_INT prev = BEGV;
2647 int inhibit_storing = 0; 2647 int inhibit_storing = 0;
2648 2648
2649 for (tail = current_buffer->overlays_before; tail; tail = tail->next) 2649 for (tail = current_buffer->overlays_before; tail; tail = tail->next)
2650 { 2650 {
2651 int startpos, endpos; 2651 EMACS_INT startpos, endpos;
2652 2652
2653 XSETMISC (overlay, tail); 2653 XSETMISC (overlay, tail);
2654 2654
2655 start = OVERLAY_START (overlay); 2655 start = OVERLAY_START (overlay);
2656 end = OVERLAY_END (overlay); 2656 end = OVERLAY_END (overlay);
2697 next = startpos; 2697 next = startpos;
2698 } 2698 }
2699 2699
2700 for (tail = current_buffer->overlays_after; tail; tail = tail->next) 2700 for (tail = current_buffer->overlays_after; tail; tail = tail->next)
2701 { 2701 {
2702 int startpos, endpos; 2702 EMACS_INT startpos, endpos;
2703 2703
2704 XSETMISC (overlay, tail); 2704 XSETMISC (overlay, tail);
2705 2705
2706 start = OVERLAY_START (overlay); 2706 start = OVERLAY_START (overlay);
2707 end = OVERLAY_END (overlay); 2707 end = OVERLAY_END (overlay);
2771 If EXTEND is zero, we never extend the vector, 2771 If EXTEND is zero, we never extend the vector,
2772 and we store only as many overlays as will fit. 2772 and we store only as many overlays as will fit.
2773 But we still return the total number of overlays. */ 2773 But we still return the total number of overlays. */
2774 2774
2775 static int 2775 static int
2776 overlays_in (int beg, int end, int extend, Lisp_Object **vec_ptr, int *len_ptr, 2776 overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
2777 int *next_ptr, int *prev_ptr) 2777 Lisp_Object **vec_ptr, int *len_ptr,
2778 EMACS_INT *next_ptr, EMACS_INT *prev_ptr)
2778 { 2779 {
2779 Lisp_Object overlay, ostart, oend; 2780 Lisp_Object overlay, ostart, oend;
2780 struct Lisp_Overlay *tail; 2781 struct Lisp_Overlay *tail;
2781 int idx = 0; 2782 int idx = 0;
2782 int len = *len_ptr; 2783 int len = *len_ptr;
2783 Lisp_Object *vec = *vec_ptr; 2784 Lisp_Object *vec = *vec_ptr;
2784 int next = ZV; 2785 EMACS_INT next = ZV;
2785 int prev = BEGV; 2786 EMACS_INT prev = BEGV;
2786 int inhibit_storing = 0; 2787 int inhibit_storing = 0;
2787 int end_is_Z = end == Z; 2788 int end_is_Z = end == Z;
2788 2789
2789 for (tail = current_buffer->overlays_before; tail; tail = tail->next) 2790 for (tail = current_buffer->overlays_before; tail; tail = tail->next)
2790 { 2791 {
2791 int startpos, endpos; 2792 EMACS_INT startpos, endpos;
2792 2793
2793 XSETMISC (overlay, tail); 2794 XSETMISC (overlay, tail);
2794 2795
2795 ostart = OVERLAY_START (overlay); 2796 ostart = OVERLAY_START (overlay);
2796 oend = OVERLAY_END (overlay); 2797 oend = OVERLAY_END (overlay);
2836 next = startpos; 2837 next = startpos;
2837 } 2838 }
2838 2839
2839 for (tail = current_buffer->overlays_after; tail; tail = tail->next) 2840 for (tail = current_buffer->overlays_after; tail; tail = tail->next)
2840 { 2841 {
2841 int startpos, endpos; 2842 EMACS_INT startpos, endpos;
2842 2843
2843 XSETMISC (overlay, tail); 2844 XSETMISC (overlay, tail);
2844 2845
2845 ostart = OVERLAY_START (overlay); 2846 ostart = OVERLAY_START (overlay);
2846 oend = OVERLAY_END (overlay); 2847 oend = OVERLAY_END (overlay);
2895 `mouse-face' property overlapping OVERLAY. */ 2896 `mouse-face' property overlapping OVERLAY. */
2896 2897
2897 int 2898 int
2898 mouse_face_overlay_overlaps (Lisp_Object overlay) 2899 mouse_face_overlay_overlaps (Lisp_Object overlay)
2899 { 2900 {
2900 int start = OVERLAY_POSITION (OVERLAY_START (overlay)); 2901 EMACS_INT start = OVERLAY_POSITION (OVERLAY_START (overlay));
2901 int end = OVERLAY_POSITION (OVERLAY_END (overlay)); 2902 EMACS_INT end = OVERLAY_POSITION (OVERLAY_END (overlay));
2902 int n, i, size; 2903 int n, i, size;
2903 Lisp_Object *v, tem; 2904 Lisp_Object *v, tem;
2904 2905
2905 size = 10; 2906 size = 10;
2906 v = (Lisp_Object *) alloca (size * sizeof *v); 2907 v = (Lisp_Object *) alloca (size * sizeof *v);
2922 2923
2923 2924
2924 2925
2925 /* Fast function to just test if we're at an overlay boundary. */ 2926 /* Fast function to just test if we're at an overlay boundary. */
2926 int 2927 int
2927 overlay_touches_p (int pos) 2928 overlay_touches_p (EMACS_INT pos)
2928 { 2929 {
2929 Lisp_Object overlay; 2930 Lisp_Object overlay;
2930 struct Lisp_Overlay *tail; 2931 struct Lisp_Overlay *tail;
2931 2932
2932 for (tail = current_buffer->overlays_before; tail; tail = tail->next) 2933 for (tail = current_buffer->overlays_before; tail; tail = tail->next)
2933 { 2934 {
2934 int endpos; 2935 EMACS_INT endpos;
2935 2936
2936 XSETMISC (overlay ,tail); 2937 XSETMISC (overlay ,tail);
2937 if (!OVERLAYP (overlay)) 2938 if (!OVERLAYP (overlay))
2938 abort (); 2939 abort ();
2939 2940
2944 return 1; 2945 return 1;
2945 } 2946 }
2946 2947
2947 for (tail = current_buffer->overlays_after; tail; tail = tail->next) 2948 for (tail = current_buffer->overlays_after; tail; tail = tail->next)
2948 { 2949 {
2949 int startpos; 2950 EMACS_INT startpos;
2950 2951
2951 XSETMISC (overlay, tail); 2952 XSETMISC (overlay, tail);
2952 if (!OVERLAYP (overlay)) 2953 if (!OVERLAYP (overlay))
2953 abort (); 2954 abort ();
2954 2955
2962 } 2963 }
2963 2964
2964 struct sortvec 2965 struct sortvec
2965 { 2966 {
2966 Lisp_Object overlay; 2967 Lisp_Object overlay;
2967 int beg, end; 2968 EMACS_INT beg, end;
2968 int priority; 2969 int priority;
2969 }; 2970 };
2970 2971
2971 static int 2972 static int
2972 compare_overlays (const void *v1, const void *v2) 2973 compare_overlays (const void *v1, const void *v2)
3049 struct sortstrlist 3050 struct sortstrlist
3050 { 3051 {
3051 struct sortstr *buf; /* An array that expands as needed; never freed. */ 3052 struct sortstr *buf; /* An array that expands as needed; never freed. */
3052 int size; /* Allocated length of that array. */ 3053 int size; /* Allocated length of that array. */
3053 int used; /* How much of the array is currently in use. */ 3054 int used; /* How much of the array is currently in use. */
3054 int bytes; /* Total length of the strings in buf. */ 3055 EMACS_INT bytes; /* Total length of the strings in buf. */
3055 }; 3056 };
3056 3057
3057 /* Buffers for storing information about the overlays touching a given 3058 /* Buffers for storing information about the overlays touching a given
3058 position. These could be automatic variables in overlay_strings, but 3059 position. These could be automatic variables in overlay_strings, but
3059 it's more efficient to hold onto the memory instead of repeatedly 3060 it's more efficient to hold onto the memory instead of repeatedly
3060 allocating and freeing it. */ 3061 allocating and freeing it. */
3061 static struct sortstrlist overlay_heads, overlay_tails; 3062 static struct sortstrlist overlay_heads, overlay_tails;
3062 static unsigned char *overlay_str_buf; 3063 static unsigned char *overlay_str_buf;
3063 3064
3064 /* Allocated length of overlay_str_buf. */ 3065 /* Allocated length of overlay_str_buf. */
3065 static int overlay_str_len; 3066 static EMACS_INT overlay_str_len;
3066 3067
3067 /* A comparison function suitable for passing to qsort. */ 3068 /* A comparison function suitable for passing to qsort. */
3068 static int 3069 static int
3069 cmp_for_strings (const void *as1, const void *as2) 3070 cmp_for_strings (const void *as1, const void *as2)
3070 { 3071 {
3078 } 3079 }
3079 3080
3080 static void 3081 static void
3081 record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str2, Lisp_Object pri, int size) 3082 record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str2, Lisp_Object pri, int size)
3082 { 3083 {
3083 int nbytes; 3084 EMACS_INT nbytes;
3084 3085
3085 if (ssl->used == ssl->size) 3086 if (ssl->used == ssl->size)
3086 { 3087 {
3087 if (ssl->buf) 3088 if (ssl->buf)
3088 ssl->size *= 2; 3089 ssl->size *= 2;
3136 int 3137 int
3137 overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) 3138 overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
3138 { 3139 {
3139 Lisp_Object overlay, window, str; 3140 Lisp_Object overlay, window, str;
3140 struct Lisp_Overlay *ov; 3141 struct Lisp_Overlay *ov;
3141 int startpos, endpos; 3142 EMACS_INT startpos, endpos;
3142 int multibyte = ! NILP (current_buffer->enable_multibyte_characters); 3143 int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
3143 3144
3144 overlay_heads.used = overlay_heads.bytes = 0; 3145 overlay_heads.used = overlay_heads.bytes = 0;
3145 overlay_tails.used = overlay_tails.bytes = 0; 3146 overlay_tails.used = overlay_tails.bytes = 0;
3146 for (ov = current_buffer->overlays_before; ov; ov = ov->next) 3147 for (ov = current_buffer->overlays_before; ov; ov = ov->next)
3206 qsort (overlay_heads.buf, overlay_heads.used, sizeof (struct sortstr), 3207 qsort (overlay_heads.buf, overlay_heads.used, sizeof (struct sortstr),
3207 cmp_for_strings); 3208 cmp_for_strings);
3208 if (overlay_heads.bytes || overlay_tails.bytes) 3209 if (overlay_heads.bytes || overlay_tails.bytes)
3209 { 3210 {
3210 Lisp_Object tem; 3211 Lisp_Object tem;
3211 int i; 3212 EMACS_INT i;
3212 unsigned char *p; 3213 unsigned char *p;
3213 int total = overlay_heads.bytes + overlay_tails.bytes; 3214 EMACS_INT total = overlay_heads.bytes + overlay_tails.bytes;
3214 3215
3215 if (total > overlay_str_len) 3216 if (total > overlay_str_len)
3216 { 3217 {
3217 overlay_str_len = total; 3218 overlay_str_len = total;
3218 overlay_str_buf = (unsigned char *)xrealloc (overlay_str_buf, 3219 overlay_str_buf = (unsigned char *)xrealloc (overlay_str_buf,
3219 total); 3220 total);
3220 } 3221 }
3221 p = overlay_str_buf; 3222 p = overlay_str_buf;
3222 for (i = overlay_tails.used; --i >= 0;) 3223 for (i = overlay_tails.used; --i >= 0;)
3223 { 3224 {
3224 int nbytes; 3225 EMACS_INT nbytes;
3225 tem = overlay_tails.buf[i].string; 3226 tem = overlay_tails.buf[i].string;
3226 nbytes = copy_text (SDATA (tem), p, 3227 nbytes = copy_text (SDATA (tem), p,
3227 SBYTES (tem), 3228 SBYTES (tem),
3228 STRING_MULTIBYTE (tem), multibyte); 3229 STRING_MULTIBYTE (tem), multibyte);
3229 p += nbytes; 3230 p += nbytes;
3230 } 3231 }
3231 for (i = 0; i < overlay_heads.used; ++i) 3232 for (i = 0; i < overlay_heads.used; ++i)
3232 { 3233 {
3233 int nbytes; 3234 EMACS_INT nbytes;
3234 tem = overlay_heads.buf[i].string; 3235 tem = overlay_heads.buf[i].string;
3235 nbytes = copy_text (SDATA (tem), p, 3236 nbytes = copy_text (SDATA (tem), p,
3236 SBYTES (tem), 3237 SBYTES (tem),
3237 STRING_MULTIBYTE (tem), multibyte); 3238 STRING_MULTIBYTE (tem), multibyte);
3238 p += nbytes; 3239 p += nbytes;
3293 end = OVERLAY_END (overlay); 3294 end = OVERLAY_END (overlay);
3294 3295
3295 if (OVERLAY_POSITION (end) > pos) 3296 if (OVERLAY_POSITION (end) > pos)
3296 { 3297 {
3297 /* OVERLAY needs to be moved. */ 3298 /* OVERLAY needs to be moved. */
3298 int where = OVERLAY_POSITION (beg); 3299 EMACS_INT where = OVERLAY_POSITION (beg);
3299 struct Lisp_Overlay *other, *other_prev; 3300 struct Lisp_Overlay *other, *other_prev;
3300 3301
3301 /* Splice the cons cell TAIL out of overlays_before. */ 3302 /* Splice the cons cell TAIL out of overlays_before. */
3302 if (prev) 3303 if (prev)
3303 prev->next = next; 3304 prev->next = next;
3366 break; 3367 break;
3367 3368
3368 if (OVERLAY_POSITION (end) <= pos) 3369 if (OVERLAY_POSITION (end) <= pos)
3369 { 3370 {
3370 /* OVERLAY needs to be moved. */ 3371 /* OVERLAY needs to be moved. */
3371 int where = OVERLAY_POSITION (end); 3372 EMACS_INT where = OVERLAY_POSITION (end);
3372 struct Lisp_Overlay *other, *other_prev; 3373 struct Lisp_Overlay *other, *other_prev;
3373 3374
3374 /* Splice the cons cell TAIL out of overlays_after. */ 3375 /* Splice the cons cell TAIL out of overlays_after. */
3375 if (prev) 3376 if (prev)
3376 prev->next = next; 3377 prev->next = next;
3438 endpoint in this range will need to be unlinked from the overlay 3439 endpoint in this range will need to be unlinked from the overlay
3439 list and reinserted in its proper place. 3440 list and reinserted in its proper place.
3440 Such an overlay might even have negative size at this point. 3441 Such an overlay might even have negative size at this point.
3441 If so, we'll make the overlay empty. */ 3442 If so, we'll make the overlay empty. */
3442 void 3443 void
3443 fix_start_end_in_overlays (register int start, register int end) 3444 fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end)
3444 { 3445 {
3445 Lisp_Object overlay; 3446 Lisp_Object overlay;
3446 struct Lisp_Overlay *before_list, *after_list; 3447 struct Lisp_Overlay *before_list, *after_list;
3447 /* These are either nil, indicating that before_list or after_list 3448 /* These are either nil, indicating that before_list or after_list
3448 should be assigned, or the cons cell the cdr of which should be 3449 should be assigned, or the cons cell the cdr of which should be
3450 struct Lisp_Overlay *beforep = NULL, *afterp = NULL; 3451 struct Lisp_Overlay *beforep = NULL, *afterp = NULL;
3451 /* 'Parent', likewise, indicates a cons cell or 3452 /* 'Parent', likewise, indicates a cons cell or
3452 current_buffer->overlays_before or overlays_after, depending 3453 current_buffer->overlays_before or overlays_after, depending
3453 which loop we're in. */ 3454 which loop we're in. */
3454 struct Lisp_Overlay *tail, *parent; 3455 struct Lisp_Overlay *tail, *parent;
3455 int startpos, endpos; 3456 EMACS_INT startpos, endpos;
3456 3457
3457 /* This algorithm shifts links around instead of consing and GCing. 3458 /* This algorithm shifts links around instead of consing and GCing.
3458 The loop invariant is that before_list (resp. after_list) is a 3459 The loop invariant is that before_list (resp. after_list) is a
3459 well-formed list except that its last element, the CDR of beforep 3460 well-formed list except that its last element, the CDR of beforep
3460 (resp. afterp) if beforep (afterp) isn't nil or before_list 3461 (resp. afterp) if beforep (afterp) isn't nil or before_list
3751 static void 3752 static void
3752 modify_overlay (struct buffer *buf, EMACS_INT start, EMACS_INT end) 3753 modify_overlay (struct buffer *buf, EMACS_INT start, EMACS_INT end)
3753 { 3754 {
3754 if (start > end) 3755 if (start > end)
3755 { 3756 {
3756 int temp = start; 3757 EMACS_INT temp = start;
3757 start = end; 3758 start = end;
3758 end = temp; 3759 end = temp;
3759 } 3760 }
3760 3761
3761 BUF_COMPUTE_UNCHANGED (buf, start, end); 3762 BUF_COMPUTE_UNCHANGED (buf, start, end);
3842 if (!EQ (buffer, obuffer)) 3843 if (!EQ (buffer, obuffer))
3843 { 3844 {
3844 /* Redisplay where the overlay was. */ 3845 /* Redisplay where the overlay was. */
3845 if (!NILP (obuffer)) 3846 if (!NILP (obuffer))
3846 { 3847 {
3847 int o_beg; 3848 EMACS_INT o_beg;
3848 int o_end; 3849 EMACS_INT o_end;
3849 3850
3850 o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); 3851 o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
3851 o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); 3852 o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
3852 3853
3853 modify_overlay (ob, o_beg, o_end); 3854 modify_overlay (ob, o_beg, o_end);
3857 modify_overlay (b, XINT (beg), XINT (end)); 3858 modify_overlay (b, XINT (beg), XINT (end));
3858 } 3859 }
3859 else 3860 else
3860 /* Redisplay the area the overlay has just left, or just enclosed. */ 3861 /* Redisplay the area the overlay has just left, or just enclosed. */
3861 { 3862 {
3862 int o_beg, o_end; 3863 EMACS_INT o_beg, o_end;
3863 3864
3864 o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); 3865 o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
3865 o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); 3866 o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
3866 3867
3867 if (o_beg == XINT (beg)) 3868 if (o_beg == XINT (beg))
4035 overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); 4036 overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
4036 4037
4037 /* Put all the overlays we want in a vector in overlay_vec. 4038 /* Put all the overlays we want in a vector in overlay_vec.
4038 Store the length in len. */ 4039 Store the length in len. */
4039 noverlays = overlays_in (XINT (beg), XINT (end), 1, &overlay_vec, &len, 4040 noverlays = overlays_in (XINT (beg), XINT (end), 1, &overlay_vec, &len,
4040 (int *) 0, (int *) 0); 4041 NULL, NULL);
4041 4042
4042 /* Make a list of them all. */ 4043 /* Make a list of them all. */
4043 result = Flist (noverlays, overlay_vec); 4044 result = Flist (noverlays, overlay_vec);
4044 4045
4045 xfree (overlay_vec); 4046 xfree (overlay_vec);
4278 /* We are being called before a change. 4279 /* We are being called before a change.
4279 Scan the overlays to find the functions to call. */ 4280 Scan the overlays to find the functions to call. */
4280 last_overlay_modification_hooks_used = 0; 4281 last_overlay_modification_hooks_used = 0;
4281 for (tail = current_buffer->overlays_before; tail; tail = tail->next) 4282 for (tail = current_buffer->overlays_before; tail; tail = tail->next)
4282 { 4283 {
4283 int startpos, endpos; 4284 EMACS_INT startpos, endpos;
4284 Lisp_Object ostart, oend; 4285 Lisp_Object ostart, oend;
4285 4286
4286 XSETMISC (overlay, tail); 4287 XSETMISC (overlay, tail);
4287 4288
4288 ostart = OVERLAY_START (overlay); 4289 ostart = OVERLAY_START (overlay);
4315 } 4316 }
4316 } 4317 }
4317 4318
4318 for (tail = current_buffer->overlays_after; tail; tail = tail->next) 4319 for (tail = current_buffer->overlays_after; tail; tail = tail->next)
4319 { 4320 {
4320 int startpos, endpos; 4321 EMACS_INT startpos, endpos;
4321 Lisp_Object ostart, oend; 4322 Lisp_Object ostart, oend;
4322 4323
4323 XSETMISC (overlay, tail); 4324 XSETMISC (overlay, tail);
4324 4325
4325 ostart = OVERLAY_START (overlay); 4326 ostart = OVERLAY_START (overlay);
4407 4408
4408 hit_list = Qnil; 4409 hit_list = Qnil;
4409 if (pos <= current_buffer->overlay_center) 4410 if (pos <= current_buffer->overlay_center)
4410 for (tail = current_buffer->overlays_before; tail; tail = tail->next) 4411 for (tail = current_buffer->overlays_before; tail; tail = tail->next)
4411 { 4412 {
4412 int endpos; 4413 EMACS_INT endpos;
4413 XSETMISC (overlay, tail); 4414 XSETMISC (overlay, tail);
4414 endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); 4415 endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
4415 if (endpos < pos) 4416 if (endpos < pos)
4416 break; 4417 break;
4417 if (endpos == pos && OVERLAY_POSITION (OVERLAY_START (overlay)) == pos 4418 if (endpos == pos && OVERLAY_POSITION (OVERLAY_START (overlay)) == pos
4419 hit_list = Fcons (overlay, hit_list); 4420 hit_list = Fcons (overlay, hit_list);
4420 } 4421 }
4421 else 4422 else
4422 for (tail = current_buffer->overlays_after; tail; tail = tail->next) 4423 for (tail = current_buffer->overlays_after; tail; tail = tail->next)
4423 { 4424 {
4424 int startpos; 4425 EMACS_INT startpos;
4425 XSETMISC (overlay, tail); 4426 XSETMISC (overlay, tail);
4426 startpos = OVERLAY_POSITION (OVERLAY_START (overlay)); 4427 startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
4427 if (startpos > pos) 4428 if (startpos > pos)
4428 break; 4429 break;
4429 if (startpos == pos && OVERLAY_POSITION (OVERLAY_END (overlay)) == pos 4430 if (startpos == pos && OVERLAY_POSITION (OVERLAY_END (overlay)) == pos