aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-09-22 15:22:06 -0400
committerEli Zaretskii2010-09-22 15:22:06 -0400
commitc8a66ab831b960c6683460cbfc5b25ff7f67493c (patch)
treee6bd1050f62c650f5d30a9947e4598136ad06253 /src
parentfc33e1531e1419780d0035aaa6cabbcb0ba4d58e (diff)
downloademacs-c8a66ab831b960c6683460cbfc5b25ff7f67493c.tar.gz
emacs-c8a66ab831b960c6683460cbfc5b25ff7f67493c.zip
Fix some more uses of int instead of EMACS_INT.
editfns.c (Fsubst_char_in_region, Ftranslate_region_internal) (check_translation): Use EMACS_INT for buffer positions and length. undo.c (record_marker_adjustment, record_delete) (record_change, record_point, record_insert) (record_property_change, Fprimitive_undo): Use EMACS_INT for buffer positions. lisp.h (record_marker_adjustment, record_delete) (record_change, record_point, record_insert) (record_property_change, Fprimitive_undo): Adjust prototypes.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/editfns.c20
-rw-r--r--src/lisp.h11
-rw-r--r--src/undo.c16
4 files changed, 41 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4d8add512a4..7036c7cc661 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12010-09-22 Eli Zaretskii <eliz@gnu.org>
2
3 * editfns.c (Fsubst_char_in_region, Ftranslate_region_internal)
4 (check_translation): Use EMACS_INT for buffer positions and
5 length.
6
7 * undo.c (record_marker_adjustment, record_delete)
8 (record_change, record_point, record_insert)
9 (record_property_change, Fprimitive_undo): Use EMACS_INT for
10 buffer positions.
11
12 * lisp.h (record_marker_adjustment, record_delete)
13 (record_change, record_point, record_insert)
14 (record_property_change, Fprimitive_undo): Adjust prototypes.
15
12010-09-22 Juanma Barranquero <lekktu@gmail.com> 162010-09-22 Juanma Barranquero <lekktu@gmail.com>
2 Eli Zaretskii <eliz@gnu.org> 17 Eli Zaretskii <eliz@gnu.org>
3 18
diff --git a/src/editfns.c b/src/editfns.c
index e78f301e433..8822dec5101 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2705,7 +2705,7 @@ and don't mark the buffer as really changed.
2705Both characters must have the same length of multi-byte form. */) 2705Both characters must have the same length of multi-byte form. */)
2706 (Lisp_Object start, Lisp_Object end, Lisp_Object fromchar, Lisp_Object tochar, Lisp_Object noundo) 2706 (Lisp_Object start, Lisp_Object end, Lisp_Object fromchar, Lisp_Object tochar, Lisp_Object noundo)
2707{ 2707{
2708 register int pos, pos_byte, stop, i, len, end_byte; 2708 register EMACS_INT pos, pos_byte, stop, i, len, end_byte;
2709 /* Keep track of the first change in the buffer: 2709 /* Keep track of the first change in the buffer:
2710 if 0 we haven't found it yet. 2710 if 0 we haven't found it yet.
2711 if < 0 we've found it and we've run the before-change-function. 2711 if < 0 we've found it and we've run the before-change-function.
@@ -2776,7 +2776,7 @@ Both characters must have the same length of multi-byte form. */)
2776 stop = min (stop, GPT_BYTE); 2776 stop = min (stop, GPT_BYTE);
2777 while (1) 2777 while (1)
2778 { 2778 {
2779 int pos_byte_next = pos_byte; 2779 EMACS_INT pos_byte_next = pos_byte;
2780 2780
2781 if (pos_byte >= stop) 2781 if (pos_byte >= stop)
2782 { 2782 {
@@ -2879,7 +2879,8 @@ Both characters must have the same length of multi-byte form. */)
2879} 2879}
2880 2880
2881 2881
2882static Lisp_Object check_translation (int, int, int, Lisp_Object); 2882static Lisp_Object check_translation (EMACS_INT, EMACS_INT, EMACS_INT,
2883 Lisp_Object);
2883 2884
2884/* Helper function for Ftranslate_region_internal. 2885/* Helper function for Ftranslate_region_internal.
2885 2886
@@ -2888,7 +2889,8 @@ static Lisp_Object check_translation (int, int, int, Lisp_Object);
2888 element is found, return it. Otherwise return Qnil. */ 2889 element is found, return it. Otherwise return Qnil. */
2889 2890
2890static Lisp_Object 2891static Lisp_Object
2891check_translation (int pos, int pos_byte, int end, Lisp_Object val) 2892check_translation (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT end,
2893 Lisp_Object val)
2892{ 2894{
2893 int buf_size = 16, buf_used = 0; 2895 int buf_size = 16, buf_used = 0;
2894 int *buf = alloca (sizeof (int) * buf_size); 2896 int *buf = alloca (sizeof (int) * buf_size);
@@ -2896,7 +2898,7 @@ check_translation (int pos, int pos_byte, int end, Lisp_Object val)
2896 for (; CONSP (val); val = XCDR (val)) 2898 for (; CONSP (val); val = XCDR (val))
2897 { 2899 {
2898 Lisp_Object elt; 2900 Lisp_Object elt;
2899 int len, i; 2901 EMACS_INT len, i;
2900 2902
2901 elt = XCAR (val); 2903 elt = XCAR (val);
2902 if (! CONSP (elt)) 2904 if (! CONSP (elt))
@@ -2912,7 +2914,7 @@ check_translation (int pos, int pos_byte, int end, Lisp_Object val)
2912 if (buf_used <= i) 2914 if (buf_used <= i)
2913 { 2915 {
2914 unsigned char *p = BYTE_POS_ADDR (pos_byte); 2916 unsigned char *p = BYTE_POS_ADDR (pos_byte);
2915 int len; 2917 int len1;
2916 2918
2917 if (buf_used == buf_size) 2919 if (buf_used == buf_size)
2918 { 2920 {
@@ -2923,8 +2925,8 @@ check_translation (int pos, int pos_byte, int end, Lisp_Object val)
2923 memcpy (newbuf, buf, sizeof (int) * buf_used); 2925 memcpy (newbuf, buf, sizeof (int) * buf_used);
2924 buf = newbuf; 2926 buf = newbuf;
2925 } 2927 }
2926 buf[buf_used++] = STRING_CHAR_AND_LENGTH (p, len); 2928 buf[buf_used++] = STRING_CHAR_AND_LENGTH (p, len1);
2927 pos_byte += len; 2929 pos_byte += len1;
2928 } 2930 }
2929 if (XINT (AREF (elt, i)) != buf[i]) 2931 if (XINT (AREF (elt, i)) != buf[i])
2930 break; 2932 break;
@@ -2950,7 +2952,7 @@ It returns the number of characters changed. */)
2950 register int nc; /* New character. */ 2952 register int nc; /* New character. */
2951 int cnt; /* Number of changes made. */ 2953 int cnt; /* Number of changes made. */
2952 int size; /* Size of translate table. */ 2954 int size; /* Size of translate table. */
2953 int pos, pos_byte, end_pos; 2955 EMACS_INT pos, pos_byte, end_pos;
2954 int multibyte = !NILP (current_buffer->enable_multibyte_characters); 2956 int multibyte = !NILP (current_buffer->enable_multibyte_characters);
2955 int string_multibyte; 2957 int string_multibyte;
2956 Lisp_Object val; 2958 Lisp_Object val;
diff --git a/src/lisp.h b/src/lisp.h
index 02cae0004f1..a1f146e45ad 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3393,12 +3393,13 @@ extern Lisp_Object Qapply;
3393extern Lisp_Object Qinhibit_read_only; 3393extern Lisp_Object Qinhibit_read_only;
3394EXFUN (Fundo_boundary, 0); 3394EXFUN (Fundo_boundary, 0);
3395extern void truncate_undo_list (struct buffer *); 3395extern void truncate_undo_list (struct buffer *);
3396extern void record_marker_adjustment (Lisp_Object, int); 3396extern void record_marker_adjustment (Lisp_Object, EMACS_INT);
3397extern void record_insert (int, int); 3397extern void record_insert (EMACS_INT, EMACS_INT);
3398extern void record_delete (int, Lisp_Object); 3398extern void record_delete (EMACS_INT, Lisp_Object);
3399extern void record_first_change (void); 3399extern void record_first_change (void);
3400extern void record_change (int, int); 3400extern void record_change (EMACS_INT, EMACS_INT);
3401extern void record_property_change (int, int, Lisp_Object, Lisp_Object, 3401extern void record_property_change (EMACS_INT, EMACS_INT,
3402 Lisp_Object, Lisp_Object,
3402 Lisp_Object); 3403 Lisp_Object);
3403extern void syms_of_undo (void); 3404extern void syms_of_undo (void);
3404extern Lisp_Object Vundo_outer_limit; 3405extern Lisp_Object Vundo_outer_limit;
diff --git a/src/undo.c b/src/undo.c
index 14a8268394a..cd3ad97349b 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -67,7 +67,7 @@ int undo_inhibit_record_point;
67 undo record that will be added just after this command terminates. */ 67 undo record that will be added just after this command terminates. */
68 68
69static void 69static void
70record_point (int pt) 70record_point (EMACS_INT pt)
71{ 71{
72 int at_boundary; 72 int at_boundary;
73 73
@@ -129,7 +129,7 @@ record_point (int pt)
129 because we don't need to record the contents.) */ 129 because we don't need to record the contents.) */
130 130
131void 131void
132record_insert (int beg, int length) 132record_insert (EMACS_INT beg, EMACS_INT length)
133{ 133{
134 Lisp_Object lbeg, lend; 134 Lisp_Object lbeg, lend;
135 135
@@ -164,7 +164,7 @@ record_insert (int beg, int length)
164 of the characters in STRING, at location BEG. */ 164 of the characters in STRING, at location BEG. */
165 165
166void 166void
167record_delete (int beg, Lisp_Object string) 167record_delete (EMACS_INT beg, Lisp_Object string)
168{ 168{
169 Lisp_Object sbeg; 169 Lisp_Object sbeg;
170 170
@@ -192,7 +192,7 @@ record_delete (int beg, Lisp_Object string)
192 won't be inverted automatically by undoing the buffer modification. */ 192 won't be inverted automatically by undoing the buffer modification. */
193 193
194void 194void
195record_marker_adjustment (Lisp_Object marker, int adjustment) 195record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment)
196{ 196{
197 if (EQ (current_buffer->undo_list, Qt)) 197 if (EQ (current_buffer->undo_list, Qt))
198 return; 198 return;
@@ -215,7 +215,7 @@ record_marker_adjustment (Lisp_Object marker, int adjustment)
215 The replacement must not change the number of characters. */ 215 The replacement must not change the number of characters. */
216 216
217void 217void
218record_change (int beg, int length) 218record_change (EMACS_INT beg, EMACS_INT length)
219{ 219{
220 record_delete (beg, make_buffer_string (beg, beg + length, 1)); 220 record_delete (beg, make_buffer_string (beg, beg + length, 1));
221 record_insert (beg, length); 221 record_insert (beg, length);
@@ -250,7 +250,9 @@ record_first_change (void)
250 for LENGTH characters starting at position BEG in BUFFER. */ 250 for LENGTH characters starting at position BEG in BUFFER. */
251 251
252void 252void
253record_property_change (int beg, int length, Lisp_Object prop, Lisp_Object value, Lisp_Object buffer) 253record_property_change (EMACS_INT beg, EMACS_INT length,
254 Lisp_Object prop, Lisp_Object value,
255 Lisp_Object buffer)
254{ 256{
255 Lisp_Object lbeg, lend, entry; 257 Lisp_Object lbeg, lend, entry;
256 struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer); 258 struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer);
@@ -601,7 +603,7 @@ Return what remains of the list. */)
601 { 603 {
602 /* Element (STRING . POS) means STRING was deleted. */ 604 /* Element (STRING . POS) means STRING was deleted. */
603 Lisp_Object membuf; 605 Lisp_Object membuf;
604 int pos = XINT (cdr); 606 EMACS_INT pos = XINT (cdr);
605 607
606 membuf = car; 608 membuf = car;
607 if (pos < 0) 609 if (pos < 0)