aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-09-23 13:10:21 -0400
committerEli Zaretskii2010-09-23 13:10:21 -0400
commit29cdc13ed61e5a64ba30df1030029898a26b7947 (patch)
treed13e5a643ad52c05cc9efaf68326b536312c0338 /src
parente79123aa347e2d9fe33b357965d93ad1ebb89b4c (diff)
downloademacs-29cdc13ed61e5a64ba30df1030029898a26b7947.tar.gz
emacs-29cdc13ed61e5a64ba30df1030029898a26b7947.zip
Fix use of int instead of EMACS_INT in editfns.c.
editfns.c (transpose_markers, update_buffer_properties) (buildmark, clip_to_bounds, Fgoto_char, overlays_around) (get_pos_property, Fconstrain_to_field) (Fline_beginning_position, Fline_end_position, Fprevious_char) (Fchar_after, Fchar_before, Finsert_char) (Finsert_buffer_substring, Fcompare_buffer_substrings) (Fsubst_char_in_region, Fformat, Ftranspose_regions): Use EMACS_INT for buffer and string position variables. lisp.h (clip_to_bounds): Adjust prototype.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/editfns.c70
-rw-r--r--src/lisp.h2
3 files changed, 50 insertions, 33 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 985698dd8cb..39f7d3ab393 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,16 @@
12010-09-23 Eli Zaretskii <eliz@gnu.org> 12010-09-23 Eli Zaretskii <eliz@gnu.org>
2 2
3 * editfns.c (transpose_markers, update_buffer_properties)
4 (buildmark, clip_to_bounds, Fgoto_char, overlays_around)
5 (get_pos_property, Fconstrain_to_field)
6 (Fline_beginning_position, Fline_end_position, Fprevious_char)
7 (Fchar_after, Fchar_before, Finsert_char)
8 (Finsert_buffer_substring, Fcompare_buffer_substrings)
9 (Fsubst_char_in_region, Fformat, Ftranspose_regions): Use
10 EMACS_INT for buffer and string position variables.
11
12 * lisp.h (clip_to_bounds): Adjust prototype.
13
3 * intervals.c (traverse_intervals, rotate_right, rotate_left) 14 * intervals.c (traverse_intervals, rotate_right, rotate_left)
4 (balance_an_interval, split_interval_right, split_interval_left) 15 (balance_an_interval, split_interval_right, split_interval_left)
5 (find_interval, next_interval, update_interval) 16 (find_interval, next_interval, update_interval)
diff --git a/src/editfns.c b/src/editfns.c
index 33bd793a17d..d8be23a8f70 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -96,7 +96,7 @@ extern Lisp_Object w32_get_internal_run_time (void);
96static int tm_diff (struct tm *, struct tm *); 96static int tm_diff (struct tm *, struct tm *);
97static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, 97static void find_field (Lisp_Object, Lisp_Object, Lisp_Object,
98 EMACS_INT *, Lisp_Object, EMACS_INT *); 98 EMACS_INT *, Lisp_Object, EMACS_INT *);
99static void update_buffer_properties (int, int); 99static void update_buffer_properties (EMACS_INT, EMACS_INT);
100static Lisp_Object region_limit (int); 100static Lisp_Object region_limit (int);
101static size_t emacs_memftimeu (char *, size_t, const char *, 101static size_t emacs_memftimeu (char *, size_t, const char *,
102 size_t, const struct tm *, int); 102 size_t, const struct tm *, int);
@@ -107,7 +107,8 @@ static void general_insert_function (void (*) (const unsigned char *, EMACS_INT)
107 int, int, Lisp_Object *); 107 int, int, Lisp_Object *);
108static Lisp_Object subst_char_in_region_unwind (Lisp_Object); 108static Lisp_Object subst_char_in_region_unwind (Lisp_Object);
109static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object); 109static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object);
110static void transpose_markers (int, int, int, int, int, int, int, int); 110static void transpose_markers (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
111 EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT);
111 112
112Lisp_Object Vbuffer_access_fontify_functions; 113Lisp_Object Vbuffer_access_fontify_functions;
113Lisp_Object Qbuffer_access_fontify_functions; 114Lisp_Object Qbuffer_access_fontify_functions;
@@ -246,7 +247,7 @@ A multibyte character is handled correctly. */)
246} 247}
247 248
248static Lisp_Object 249static Lisp_Object
249buildmark (int charpos, int bytepos) 250buildmark (EMACS_INT charpos, EMACS_INT bytepos)
250{ 251{
251 register Lisp_Object mark; 252 register Lisp_Object mark;
252 mark = Fmake_marker (); 253 mark = Fmake_marker ();
@@ -272,7 +273,7 @@ DEFUN ("point-marker", Fpoint_marker, Spoint_marker, 0, 0, 0,
272} 273}
273 274
274int 275int
275clip_to_bounds (int lower, int num, int upper) 276clip_to_bounds (EMACS_INT lower, EMACS_INT num, EMACS_INT upper)
276{ 277{
277 if (num < lower) 278 if (num < lower)
278 return lower; 279 return lower;
@@ -289,7 +290,7 @@ Beginning of buffer is position (point-min), end is (point-max).
289The return value is POSITION. */) 290The return value is POSITION. */)
290 (register Lisp_Object position) 291 (register Lisp_Object position)
291{ 292{
292 int pos; 293 EMACS_INT pos;
293 294
294 if (MARKERP (position) 295 if (MARKERP (position)
295 && current_buffer == XMARKER (position)->buffer) 296 && current_buffer == XMARKER (position)->buffer)
@@ -365,11 +366,11 @@ If you set the marker not to point anywhere, the buffer will have no mark. */)
365 of length LEN. */ 366 of length LEN. */
366 367
367static int 368static int
368overlays_around (int pos, Lisp_Object *vec, int len) 369overlays_around (EMACS_INT pos, Lisp_Object *vec, int len)
369{ 370{
370 Lisp_Object overlay, start, end; 371 Lisp_Object overlay, start, end;
371 struct Lisp_Overlay *tail; 372 struct Lisp_Overlay *tail;
372 int startpos, endpos; 373 EMACS_INT startpos, endpos;
373 int idx = 0; 374 int idx = 0;
374 375
375 for (tail = current_buffer->overlays_before; tail; tail = tail->next) 376 for (tail = current_buffer->overlays_before; tail; tail = tail->next)
@@ -437,7 +438,7 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o
437 return Fget_text_property (position, prop, object); 438 return Fget_text_property (position, prop, object);
438 else 439 else
439 { 440 {
440 int posn = XINT (position); 441 EMACS_INT posn = XINT (position);
441 int noverlays; 442 int noverlays;
442 Lisp_Object *overlay_vec, tem; 443 Lisp_Object *overlay_vec, tem;
443 struct buffer *obuf = current_buffer; 444 struct buffer *obuf = current_buffer;
@@ -723,7 +724,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
723 (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property) 724 (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property)
724{ 725{
725 /* If non-zero, then the original point, before re-positioning. */ 726 /* If non-zero, then the original point, before re-positioning. */
726 int orig_point = 0; 727 EMACS_INT orig_point = 0;
727 int fwd; 728 int fwd;
728 Lisp_Object prev_old, prev_new; 729 Lisp_Object prev_old, prev_new;
729 730
@@ -820,7 +821,7 @@ boundaries bind `inhibit-field-text-motion' to t.
820This function does not move point. */) 821This function does not move point. */)
821 (Lisp_Object n) 822 (Lisp_Object n)
822{ 823{
823 int orig, orig_byte, end; 824 EMACS_INT orig, orig_byte, end;
824 int count = SPECPDL_INDEX (); 825 int count = SPECPDL_INDEX ();
825 specbind (Qinhibit_point_motion_hooks, Qt); 826 specbind (Qinhibit_point_motion_hooks, Qt);
826 827
@@ -861,8 +862,8 @@ boundaries bind `inhibit-field-text-motion' to t.
861This function does not move point. */) 862This function does not move point. */)
862 (Lisp_Object n) 863 (Lisp_Object n)
863{ 864{
864 int end_pos; 865 EMACS_INT end_pos;
865 int orig = PT; 866 EMACS_INT orig = PT;
866 867
867 if (NILP (n)) 868 if (NILP (n))
868 XSETFASTINT (n, 1); 869 XSETFASTINT (n, 1);
@@ -1134,7 +1135,7 @@ At the beginning of the buffer or accessible region, return 0. */)
1134 XSETFASTINT (temp, 0); 1135 XSETFASTINT (temp, 0);
1135 else if (!NILP (current_buffer->enable_multibyte_characters)) 1136 else if (!NILP (current_buffer->enable_multibyte_characters))
1136 { 1137 {
1137 int pos = PT_BYTE; 1138 EMACS_INT pos = PT_BYTE;
1138 DEC_POS (pos); 1139 DEC_POS (pos);
1139 XSETFASTINT (temp, FETCH_CHAR (pos)); 1140 XSETFASTINT (temp, FETCH_CHAR (pos));
1140 } 1141 }
@@ -1188,7 +1189,7 @@ POS is an integer or a marker and defaults to point.
1188If POS is out of range, the value is nil. */) 1189If POS is out of range, the value is nil. */)
1189 (Lisp_Object pos) 1190 (Lisp_Object pos)
1190{ 1191{
1191 register int pos_byte; 1192 register EMACS_INT pos_byte;
1192 1193
1193 if (NILP (pos)) 1194 if (NILP (pos))
1194 { 1195 {
@@ -1221,7 +1222,7 @@ If POS is out of range, the value is nil. */)
1221 (Lisp_Object pos) 1222 (Lisp_Object pos)
1222{ 1223{
1223 register Lisp_Object val; 1224 register Lisp_Object val;
1224 register int pos_byte; 1225 register EMACS_INT pos_byte;
1225 1226
1226 if (NILP (pos)) 1227 if (NILP (pos))
1227 { 1228 {
@@ -2270,7 +2271,8 @@ from adjoining text, if those properties are sticky. */)
2270{ 2271{
2271 register unsigned char *string; 2272 register unsigned char *string;
2272 register int strlen; 2273 register int strlen;
2273 register int i, n; 2274 register int i;
2275 register EMACS_INT n;
2274 int len; 2276 int len;
2275 unsigned char str[MAX_MULTIBYTE_LENGTH]; 2277 unsigned char str[MAX_MULTIBYTE_LENGTH];
2276 2278
@@ -2281,6 +2283,8 @@ from adjoining text, if those properties are sticky. */)
2281 len = CHAR_STRING (XFASTINT (character), str); 2283 len = CHAR_STRING (XFASTINT (character), str);
2282 else 2284 else
2283 str[0] = XFASTINT (character), len = 1; 2285 str[0] = XFASTINT (character), len = 1;
2286 if (MOST_POSITIVE_FIXNUM / len < XINT (count))
2287 error ("Maximum buffer size would be exceeded");
2284 n = XINT (count) * len; 2288 n = XINT (count) * len;
2285 if (n <= 0) 2289 if (n <= 0)
2286 return Qnil; 2290 return Qnil;
@@ -2404,7 +2408,7 @@ make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte,
2404 in the current buffer, if necessary. */ 2408 in the current buffer, if necessary. */
2405 2409
2406static void 2410static void
2407update_buffer_properties (int start, int end) 2411update_buffer_properties (EMACS_INT start, EMACS_INT end)
2408{ 2412{
2409 /* If this buffer has some access functions, 2413 /* If this buffer has some access functions,
2410 call them, specifying the range of the buffer being accessed. */ 2414 call them, specifying the range of the buffer being accessed. */
@@ -2485,7 +2489,7 @@ Arguments START and END are character positions specifying the substring.
2485They default to the values of (point-min) and (point-max) in BUFFER. */) 2489They default to the values of (point-min) and (point-max) in BUFFER. */)
2486 (Lisp_Object buffer, Lisp_Object start, Lisp_Object end) 2490 (Lisp_Object buffer, Lisp_Object start, Lisp_Object end)
2487{ 2491{
2488 register int b, e, temp; 2492 register EMACS_INT b, e, temp;
2489 register struct buffer *bp, *obuf; 2493 register struct buffer *bp, *obuf;
2490 Lisp_Object buf; 2494 Lisp_Object buf;
2491 2495
@@ -2538,13 +2542,13 @@ The value of `case-fold-search' in the current buffer
2538determines whether case is significant or ignored. */) 2542determines whether case is significant or ignored. */)
2539 (Lisp_Object buffer1, Lisp_Object start1, Lisp_Object end1, Lisp_Object buffer2, Lisp_Object start2, Lisp_Object end2) 2543 (Lisp_Object buffer1, Lisp_Object start1, Lisp_Object end1, Lisp_Object buffer2, Lisp_Object start2, Lisp_Object end2)
2540{ 2544{
2541 register int begp1, endp1, begp2, endp2, temp; 2545 register EMACS_INT begp1, endp1, begp2, endp2, temp;
2542 register struct buffer *bp1, *bp2; 2546 register struct buffer *bp1, *bp2;
2543 register Lisp_Object trt 2547 register Lisp_Object trt
2544 = (!NILP (current_buffer->case_fold_search) 2548 = (!NILP (current_buffer->case_fold_search)
2545 ? current_buffer->case_canon_table : Qnil); 2549 ? current_buffer->case_canon_table : Qnil);
2546 int chars = 0; 2550 EMACS_INT chars = 0;
2547 int i1, i2, i1_byte, i2_byte; 2551 EMACS_INT i1, i2, i1_byte, i2_byte;
2548 2552
2549 /* Find the first buffer and its substring. */ 2553 /* Find the first buffer and its substring. */
2550 2554
@@ -2710,7 +2714,7 @@ Both characters must have the same length of multi-byte form. */)
2710 if 0 we haven't found it yet. 2714 if 0 we haven't found it yet.
2711 if < 0 we've found it and we've run the before-change-function. 2715 if < 0 we've found it and we've run the before-change-function.
2712 if > 0 we've actually performed it and the value is its position. */ 2716 if > 0 we've actually performed it and the value is its position. */
2713 int changed = 0; 2717 EMACS_INT changed = 0;
2714 unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH]; 2718 unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH];
2715 unsigned char *p; 2719 unsigned char *p;
2716 int count = SPECPDL_INDEX (); 2720 int count = SPECPDL_INDEX ();
@@ -2719,7 +2723,7 @@ Both characters must have the same length of multi-byte form. */)
2719#define COMBINING_AFTER 2 2723#define COMBINING_AFTER 2
2720#define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) 2724#define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER)
2721 int maybe_byte_combining = COMBINING_NO; 2725 int maybe_byte_combining = COMBINING_NO;
2722 int last_changed = 0; 2726 EMACS_INT last_changed = 0;
2723 int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); 2727 int multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
2724 2728
2725 restart: 2729 restart:
@@ -3514,7 +3518,7 @@ usage: (format STRING &rest OBJECTS) */)
3514 (int nargs, register Lisp_Object *args) 3518 (int nargs, register Lisp_Object *args)
3515{ 3519{
3516 register int n; /* The number of the next arg to substitute */ 3520 register int n; /* The number of the next arg to substitute */
3517 register int total; /* An estimate of the final length */ 3521 register EMACS_INT total; /* An estimate of the final length */
3518 char *buf, *p; 3522 char *buf, *p;
3519 register unsigned char *format, *end, *format_start; 3523 register unsigned char *format, *end, *format_start;
3520 int nchars; 3524 int nchars;
@@ -3608,7 +3612,7 @@ usage: (format STRING &rest OBJECTS) */)
3608 while (format != end) 3612 while (format != end)
3609 if (*format++ == '%') 3613 if (*format++ == '%')
3610 { 3614 {
3611 int thissize = 0; 3615 EMACS_INT thissize = 0;
3612 EMACS_INT actual_width = 0; 3616 EMACS_INT actual_width = 0;
3613 unsigned char *this_format_start = format - 1; 3617 unsigned char *this_format_start = format - 1;
3614 int field_width = 0; 3618 int field_width = 0;
@@ -4023,7 +4027,8 @@ usage: (format STRING &rest OBJECTS) */)
4023 4027
4024 if (CONSP (props)) 4028 if (CONSP (props))
4025 { 4029 {
4026 int bytepos = 0, position = 0, translated = 0, argn = 1; 4030 EMACS_INT bytepos = 0, position = 0, translated = 0;
4031 int argn = 1;
4027 Lisp_Object list; 4032 Lisp_Object list;
4028 4033
4029 /* Adjust the bounds of each text property 4034 /* Adjust the bounds of each text property
@@ -4041,7 +4046,7 @@ usage: (format STRING &rest OBJECTS) */)
4041 for (list = props; CONSP (list); list = XCDR (list)) 4046 for (list = props; CONSP (list); list = XCDR (list))
4042 { 4047 {
4043 Lisp_Object item; 4048 Lisp_Object item;
4044 int pos; 4049 EMACS_INT pos;
4045 4050
4046 item = XCAR (list); 4051 item = XCAR (list);
4047 4052
@@ -4177,11 +4182,12 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */)
4177 It's the caller's job to ensure that START1 <= END1 <= START2 <= END2. */ 4182 It's the caller's job to ensure that START1 <= END1 <= START2 <= END2. */
4178 4183
4179static void 4184static void
4180transpose_markers (int start1, int end1, int start2, int end2, 4185transpose_markers (EMACS_INT start1, EMACS_INT end1,
4181 int start1_byte, int end1_byte, 4186 EMACS_INT start2, EMACS_INT end2,
4182 int start2_byte, int end2_byte) 4187 EMACS_INT start1_byte, EMACS_INT end1_byte,
4188 EMACS_INT start2_byte, EMACS_INT end2_byte)
4183{ 4189{
4184 register int amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos; 4190 register EMACS_INT amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos;
4185 register struct Lisp_Marker *marker; 4191 register struct Lisp_Marker *marker;
4186 4192
4187 /* Update point as if it were a marker. */ 4193 /* Update point as if it were a marker. */
@@ -4278,7 +4284,7 @@ Transposing beyond buffer boundaries is an error. */)
4278 /* Swap the regions if they're reversed. */ 4284 /* Swap the regions if they're reversed. */
4279 if (start2 < end1) 4285 if (start2 < end1)
4280 { 4286 {
4281 register int glumph = start1; 4287 register EMACS_INT glumph = start1;
4282 start1 = start2; 4288 start1 = start2;
4283 start2 = glumph; 4289 start2 = glumph;
4284 glumph = end1; 4290 glumph = end1;
diff --git a/src/lisp.h b/src/lisp.h
index 3633b3bc855..c53ea1221ed 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2991,7 +2991,7 @@ EXFUN (Fwiden, 0);
2991EXFUN (Fuser_login_name, 1); 2991EXFUN (Fuser_login_name, 1);
2992EXFUN (Fsystem_name, 0); 2992EXFUN (Fsystem_name, 0);
2993EXFUN (Fcurrent_time, 0); 2993EXFUN (Fcurrent_time, 0);
2994extern int clip_to_bounds (int, int, int); 2994extern int clip_to_bounds (EMACS_INT, EMACS_INT, EMACS_INT);
2995extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int); 2995extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int);
2996extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT, 2996extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT,
2997 EMACS_INT, int); 2997 EMACS_INT, int);