aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-02-06 11:44:36 -0800
committerPaul Eggert2011-02-06 11:44:36 -0800
commitb68864e5b9b695570d35dd7c41d5d010ba7cc87d (patch)
tree4ca664d771a5b7482d1a726406cbfd4d46531fb8 /src
parentf8b351c190ecb3d01bd81a0c4624153b15a95f89 (diff)
downloademacs-b68864e5b9b695570d35dd7c41d5d010ba7cc87d.tar.gz
emacs-b68864e5b9b695570d35dd7c41d5d010ba7cc87d.zip
* insdel.c: conform to C89 pointer rules
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/buffer.c2
-rw-r--r--src/cmds.c7
-rw-r--r--src/coding.c2
-rw-r--r--src/editfns.c10
-rw-r--r--src/fileio.c2
-rw-r--r--src/insdel.c27
-rw-r--r--src/lisp.h13
-rw-r--r--src/print.c2
-rw-r--r--src/xdisp.c16
10 files changed, 46 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ffd669b4ad7..35883220197 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -17,6 +17,13 @@
17 * image.c (xbm_read_bitmap_data, xbm_load_image, xbm_load): Likewise. 17 * image.c (xbm_read_bitmap_data, xbm_load_image, xbm_load): Likewise.
18 * keyboard.c (echo_char, MULTI_LETTER_MOD, tty_read_avail_input): 18 * keyboard.c (echo_char, MULTI_LETTER_MOD, tty_read_avail_input):
19 Likewise. 19 Likewise.
20 * insdel.c (insert, insert_and_inherit, insert_before_markers):
21 (insert_before_markers_and_inherit, insert_1, insert_1_both):
22 Likewise. This changes these functions' signatures, which is
23 more convenient since most callers use char *. All remaining
24 callers changed.
25 * editfns.c (general_insert_function): Change signature to
26 match changes to insert functions' signatures.
20 27
212011-02-05 Paul Eggert <eggert@cs.ucla.edu> 282011-02-05 Paul Eggert <eggert@cs.ucla.edu>
22 29
diff --git a/src/buffer.c b/src/buffer.c
index 2c6eb7b84e3..f8008195498 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2401,7 +2401,7 @@ current buffer is cleared. */)
2401 *p = tmp[0]; 2401 *p = tmp[0];
2402 TEMP_SET_PT_BOTH (pos + 1, pos + 1); 2402 TEMP_SET_PT_BOTH (pos + 1, pos + 1);
2403 bytes--; 2403 bytes--;
2404 insert_1_both (tmp + 1, bytes, bytes, 1, 0, 0); 2404 insert_1_both ((char *) tmp + 1, bytes, bytes, 1, 0, 0);
2405 /* Now the gap is after the just inserted data. */ 2405 /* Now the gap is after the just inserted data. */
2406 pos = GPT; 2406 pos = GPT;
2407 p = GAP_END_ADDR; 2407 p = GAP_END_ADDR;
diff --git a/src/cmds.c b/src/cmds.c
index ce05b19e1c2..93b7e2b7651 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -466,15 +466,15 @@ internal_self_insert (int c, EMACS_INT n)
466 else if (n > 1) 466 else if (n > 1)
467 { 467 {
468 USE_SAFE_ALLOCA; 468 USE_SAFE_ALLOCA;
469 unsigned char *strn, *p; 469 char *strn, *p;
470 SAFE_ALLOCA (strn, unsigned char*, n * len); 470 SAFE_ALLOCA (strn, char *, n * len);
471 for (p = strn; n > 0; n--, p += len) 471 for (p = strn; n > 0; n--, p += len)
472 memcpy (p, str, len); 472 memcpy (p, str, len);
473 insert_and_inherit (strn, p - strn); 473 insert_and_inherit (strn, p - strn);
474 SAFE_FREE (); 474 SAFE_FREE ();
475 } 475 }
476 else if (n > 0) 476 else if (n > 0)
477 insert_and_inherit (str, len); 477 insert_and_inherit ((char *) str, len);
478 478
479 if ((CHAR_TABLE_P (Vauto_fill_chars) 479 if ((CHAR_TABLE_P (Vauto_fill_chars)
480 ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c)) 480 ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c))
@@ -559,4 +559,3 @@ keys_of_cmds (void)
559 initial_define_key (global_map, Ctl ('E'), "end-of-line"); 559 initial_define_key (global_map, Ctl ('E'), "end-of-line");
560 initial_define_key (global_map, Ctl ('F'), "forward-char"); 560 initial_define_key (global_map, Ctl ('F'), "forward-char");
561} 561}
562
diff --git a/src/coding.c b/src/coding.c
index 3a3ba11ee9d..a9f16de56f3 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7880,7 +7880,7 @@ encode_coding_object (struct coding_system *coding,
7880 else if (BUFFERP (src_object)) 7880 else if (BUFFERP (src_object))
7881 insert_from_buffer (XBUFFER (src_object), from, chars, 0); 7881 insert_from_buffer (XBUFFER (src_object), from, chars, 0);
7882 else 7882 else
7883 insert_1_both (coding->source + from, chars, bytes, 0, 0, 0); 7883 insert_1_both ((char *) coding->source + from, chars, bytes, 0, 0, 0);
7884 7884
7885 if (EQ (src_object, dst_object)) 7885 if (EQ (src_object, dst_object))
7886 { 7886 {
diff --git a/src/editfns.c b/src/editfns.c
index f70b3312a69..3b14379be11 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -94,7 +94,7 @@ static void update_buffer_properties (EMACS_INT, EMACS_INT);
94static Lisp_Object region_limit (int); 94static Lisp_Object region_limit (int);
95static size_t emacs_nmemftime (char *, size_t, const char *, 95static size_t emacs_nmemftime (char *, size_t, const char *,
96 size_t, const struct tm *, int, int); 96 size_t, const struct tm *, int, int);
97static void general_insert_function (void (*) (const unsigned char *, EMACS_INT), 97static void general_insert_function (void (*) (const char *, EMACS_INT),
98 void (*) (Lisp_Object, EMACS_INT, 98 void (*) (Lisp_Object, EMACS_INT,
99 EMACS_INT, EMACS_INT, 99 EMACS_INT, EMACS_INT,
100 EMACS_INT, int), 100 EMACS_INT, int),
@@ -2118,7 +2118,7 @@ set_time_zone_rule (const char *tzstring)
2118 2118
2119static void 2119static void
2120general_insert_function (void (*insert_func) 2120general_insert_function (void (*insert_func)
2121 (const unsigned char *, EMACS_INT), 2121 (const char *, EMACS_INT),
2122 void (*insert_from_string_func) 2122 void (*insert_from_string_func)
2123 (Lisp_Object, EMACS_INT, EMACS_INT, 2123 (Lisp_Object, EMACS_INT, EMACS_INT,
2124 EMACS_INT, EMACS_INT, int), 2124 EMACS_INT, EMACS_INT, int),
@@ -2144,7 +2144,7 @@ general_insert_function (void (*insert_func)
2144 : multibyte_char_to_unibyte (XINT (val), Qnil)); 2144 : multibyte_char_to_unibyte (XINT (val), Qnil));
2145 len = 1; 2145 len = 1;
2146 } 2146 }
2147 (*insert_func) (str, len); 2147 (*insert_func) ((char *) str, len);
2148 } 2148 }
2149 else if (STRINGP (val)) 2149 else if (STRINGP (val))
2150 { 2150 {
@@ -2257,7 +2257,7 @@ The optional third arg INHERIT, if non-nil, says to inherit text properties
2257from adjoining text, if those properties are sticky. */) 2257from adjoining text, if those properties are sticky. */)
2258 (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) 2258 (Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
2259{ 2259{
2260 register unsigned char *string; 2260 register char *string;
2261 register EMACS_INT strlen; 2261 register EMACS_INT strlen;
2262 register int i; 2262 register int i;
2263 register EMACS_INT n; 2263 register EMACS_INT n;
@@ -2277,7 +2277,7 @@ from adjoining text, if those properties are sticky. */)
2277 if (n <= 0) 2277 if (n <= 0)
2278 return Qnil; 2278 return Qnil;
2279 strlen = min (n, 256 * len); 2279 strlen = min (n, 256 * len);
2280 string = (unsigned char *) alloca (strlen); 2280 string = (char *) alloca (strlen);
2281 for (i = 0; i < strlen; i++) 2281 for (i = 0; i < strlen; i++)
2282 string[i] = str[i % len]; 2282 string[i] = str[i % len];
2283 while (n >= strlen) 2283 while (n >= strlen)
diff --git a/src/fileio.c b/src/fileio.c
index 3c61ee57bf2..53732f7180f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3412,7 +3412,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3412 Ferase_buffer (); 3412 Ferase_buffer ();
3413 buf->enable_multibyte_characters = Qnil; 3413 buf->enable_multibyte_characters = Qnil;
3414 3414
3415 insert_1_both (read_buf, nread, nread, 0, 0, 0); 3415 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
3416 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3416 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
3417 coding_system = call2 (Vset_auto_coding_function, 3417 coding_system = call2 (Vset_auto_coding_function,
3418 filename, make_number (nread)); 3418 filename, make_number (nread));
diff --git a/src/insdel.c b/src/insdel.c
index 8923a9e12e5..db76f770dad 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -668,11 +668,11 @@ count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes)
668 prepare_to_modify_buffer could relocate the text. */ 668 prepare_to_modify_buffer could relocate the text. */
669 669
670void 670void
671insert (const unsigned char *string, EMACS_INT nbytes) 671insert (const char *string, EMACS_INT nbytes)
672{ 672{
673 if (nbytes > 0) 673 if (nbytes > 0)
674 { 674 {
675 EMACS_INT len = chars_in_text (string, nbytes), opoint; 675 EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
676 insert_1_both (string, len, nbytes, 0, 1, 0); 676 insert_1_both (string, len, nbytes, 0, 1, 0);
677 opoint = PT - len; 677 opoint = PT - len;
678 signal_after_change (opoint, 0, len); 678 signal_after_change (opoint, 0, len);
@@ -683,11 +683,11 @@ insert (const unsigned char *string, EMACS_INT nbytes)
683/* Likewise, but inherit text properties from neighboring characters. */ 683/* Likewise, but inherit text properties from neighboring characters. */
684 684
685void 685void
686insert_and_inherit (const unsigned char *string, EMACS_INT nbytes) 686insert_and_inherit (const char *string, EMACS_INT nbytes)
687{ 687{
688 if (nbytes > 0) 688 if (nbytes > 0)
689 { 689 {
690 EMACS_INT len = chars_in_text (string, nbytes), opoint; 690 EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
691 insert_1_both (string, len, nbytes, 1, 1, 0); 691 insert_1_both (string, len, nbytes, 1, 1, 0);
692 opoint = PT - len; 692 opoint = PT - len;
693 signal_after_change (opoint, 0, len); 693 signal_after_change (opoint, 0, len);
@@ -711,7 +711,7 @@ insert_char (int c)
711 str[0] = c; 711 str[0] = c;
712 } 712 }
713 713
714 insert (str, len); 714 insert ((char *) str, len);
715} 715}
716 716
717/* Insert the null-terminated string S before point. */ 717/* Insert the null-terminated string S before point. */
@@ -728,11 +728,11 @@ insert_string (const char *s)
728 since gc could happen and relocate it. */ 728 since gc could happen and relocate it. */
729 729
730void 730void
731insert_before_markers (const unsigned char *string, EMACS_INT nbytes) 731insert_before_markers (const char *string, EMACS_INT nbytes)
732{ 732{
733 if (nbytes > 0) 733 if (nbytes > 0)
734 { 734 {
735 EMACS_INT len = chars_in_text (string, nbytes), opoint; 735 EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
736 insert_1_both (string, len, nbytes, 0, 1, 1); 736 insert_1_both (string, len, nbytes, 0, 1, 1);
737 opoint = PT - len; 737 opoint = PT - len;
738 signal_after_change (opoint, 0, len); 738 signal_after_change (opoint, 0, len);
@@ -743,12 +743,12 @@ insert_before_markers (const unsigned char *string, EMACS_INT nbytes)
743/* Likewise, but inherit text properties from neighboring characters. */ 743/* Likewise, but inherit text properties from neighboring characters. */
744 744
745void 745void
746insert_before_markers_and_inherit (const unsigned char *string, 746insert_before_markers_and_inherit (const char *string,
747 EMACS_INT nbytes) 747 EMACS_INT nbytes)
748{ 748{
749 if (nbytes > 0) 749 if (nbytes > 0)
750 { 750 {
751 EMACS_INT len = chars_in_text (string, nbytes), opoint; 751 EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
752 insert_1_both (string, len, nbytes, 1, 1, 1); 752 insert_1_both (string, len, nbytes, 1, 1, 1);
753 opoint = PT - len; 753 opoint = PT - len;
754 signal_after_change (opoint, 0, len); 754 signal_after_change (opoint, 0, len);
@@ -759,11 +759,11 @@ insert_before_markers_and_inherit (const unsigned char *string,
759/* Subroutine used by the insert functions above. */ 759/* Subroutine used by the insert functions above. */
760 760
761void 761void
762insert_1 (const unsigned char *string, EMACS_INT nbytes, 762insert_1 (const char *string, EMACS_INT nbytes,
763 int inherit, int prepare, int before_markers) 763 int inherit, int prepare, int before_markers)
764{ 764{
765 insert_1_both (string, chars_in_text (string, nbytes), nbytes, 765 insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes),
766 inherit, prepare, before_markers); 766 nbytes, inherit, prepare, before_markers);
767} 767}
768 768
769 769
@@ -884,7 +884,7 @@ count_combining_after (const unsigned char *string,
884 are the same as in insert_1. */ 884 are the same as in insert_1. */
885 885
886void 886void
887insert_1_both (const unsigned char *string, 887insert_1_both (const char *string,
888 EMACS_INT nchars, EMACS_INT nbytes, 888 EMACS_INT nchars, EMACS_INT nbytes,
889 int inherit, int prepare, int before_markers) 889 int inherit, int prepare, int before_markers)
890{ 890{
@@ -2382,4 +2382,3 @@ as well as hooks attached to text properties and overlays. */);
2382 2382
2383 defsubr (&Scombine_after_change_execute); 2383 defsubr (&Scombine_after_change_execute);
2384} 2384}
2385
diff --git a/src/lisp.h b/src/lisp.h
index cfff42a84a4..7821efff8ef 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2555,10 +2555,10 @@ extern int count_combining_before (const unsigned char *,
2555 EMACS_INT, EMACS_INT, EMACS_INT); 2555 EMACS_INT, EMACS_INT, EMACS_INT);
2556extern int count_combining_after (const unsigned char *, 2556extern int count_combining_after (const unsigned char *,
2557 EMACS_INT, EMACS_INT, EMACS_INT); 2557 EMACS_INT, EMACS_INT, EMACS_INT);
2558extern void insert (const unsigned char *, EMACS_INT); 2558extern void insert (const char *, EMACS_INT);
2559extern void insert_and_inherit (const unsigned char *, EMACS_INT); 2559extern void insert_and_inherit (const char *, EMACS_INT);
2560extern void insert_1 (const unsigned char *, EMACS_INT, int, int, int); 2560extern void insert_1 (const char *, EMACS_INT, int, int, int);
2561extern void insert_1_both (const unsigned char *, EMACS_INT, EMACS_INT, 2561extern void insert_1_both (const char *, EMACS_INT, EMACS_INT,
2562 int, int, int); 2562 int, int, int);
2563extern void insert_from_gap (EMACS_INT, EMACS_INT); 2563extern void insert_from_gap (EMACS_INT, EMACS_INT);
2564extern void insert_from_string (Lisp_Object, EMACS_INT, EMACS_INT, 2564extern void insert_from_string (Lisp_Object, EMACS_INT, EMACS_INT,
@@ -2566,9 +2566,8 @@ extern void insert_from_string (Lisp_Object, EMACS_INT, EMACS_INT,
2566extern void insert_from_buffer (struct buffer *, EMACS_INT, EMACS_INT, int); 2566extern void insert_from_buffer (struct buffer *, EMACS_INT, EMACS_INT, int);
2567extern void insert_char (int); 2567extern void insert_char (int);
2568extern void insert_string (const char *); 2568extern void insert_string (const char *);
2569extern void insert_before_markers (const unsigned char *, EMACS_INT); 2569extern void insert_before_markers (const char *, EMACS_INT);
2570extern void insert_before_markers_and_inherit (const unsigned char *, 2570extern void insert_before_markers_and_inherit (const char *, EMACS_INT);
2571 EMACS_INT);
2572extern void insert_from_string_before_markers (Lisp_Object, EMACS_INT, 2571extern void insert_from_string_before_markers (Lisp_Object, EMACS_INT,
2573 EMACS_INT, EMACS_INT, 2572 EMACS_INT, EMACS_INT,
2574 EMACS_INT, int); 2573 EMACS_INT, int);
diff --git a/src/print.c b/src/print.c
index 8bef7a76f4d..09904e078b8 100644
--- a/src/print.c
+++ b/src/print.c
@@ -179,7 +179,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
179 = (unsigned char *) alloca (print_buffer_pos + 1); \ 179 = (unsigned char *) alloca (print_buffer_pos + 1); \
180 copy_text (print_buffer, temp, print_buffer_pos_byte, \ 180 copy_text (print_buffer, temp, print_buffer_pos_byte, \
181 1, 0); \ 181 1, 0); \
182 insert_1_both (temp, print_buffer_pos, \ 182 insert_1_both ((char *) temp, print_buffer_pos, \
183 print_buffer_pos, 0, 1, 0); \ 183 print_buffer_pos, 0, 1, 0); \
184 } \ 184 } \
185 else \ 185 else \
diff --git a/src/xdisp.c b/src/xdisp.c
index adf0d1b8745..630c1dcda85 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7930,7 +7930,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7930 { 7930 {
7931 EMACS_INT i; 7931 EMACS_INT i;
7932 int c, char_bytes; 7932 int c, char_bytes;
7933 unsigned char work[1]; 7933 char work[1];
7934 7934
7935 /* Convert a multibyte string to single-byte 7935 /* Convert a multibyte string to single-byte
7936 for the *Message* buffer. */ 7936 for the *Message* buffer. */
@@ -7956,17 +7956,17 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7956 c = msg[i]; 7956 c = msg[i];
7957 MAKE_CHAR_MULTIBYTE (c); 7957 MAKE_CHAR_MULTIBYTE (c);
7958 char_bytes = CHAR_STRING (c, str); 7958 char_bytes = CHAR_STRING (c, str);
7959 insert_1_both (str, 1, char_bytes, 1, 0, 0); 7959 insert_1_both ((char *) str, 1, char_bytes, 1, 0, 0);
7960 } 7960 }
7961 } 7961 }
7962 else if (nbytes) 7962 else if (nbytes)
7963 insert_1 (msg, nbytes, 1, 0, 0); 7963 insert_1 (m, nbytes, 1, 0, 0);
7964 7964
7965 if (nlflag) 7965 if (nlflag)
7966 { 7966 {
7967 EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; 7967 EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte;
7968 int dup; 7968 int dup;
7969 insert_1 ((const unsigned char *) "\n", 1, 1, 0, 0); 7969 insert_1 ("\n", 1, 1, 0, 0);
7970 7970
7971 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); 7971 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0);
7972 this_bol = PT; 7972 this_bol = PT;
@@ -7996,7 +7996,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
7996 sprintf (dupstr, " [%d times]", dup); 7996 sprintf (dupstr, " [%d times]", dup);
7997 duplen = strlen (dupstr); 7997 duplen = strlen (dupstr);
7998 TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); 7998 TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1);
7999 insert_1 ((unsigned char *) dupstr, duplen, 1, 0, 1); 7999 insert_1 (dupstr, duplen, 1, 0, 1);
8000 } 8000 }
8001 } 8001 }
8002 } 8002 }
@@ -9193,7 +9193,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9193 /* Convert from multi-byte to single-byte. */ 9193 /* Convert from multi-byte to single-byte. */
9194 EMACS_INT i; 9194 EMACS_INT i;
9195 int c, n; 9195 int c, n;
9196 unsigned char work[1]; 9196 char work[1];
9197 9197
9198 /* Convert a multibyte string to single-byte. */ 9198 /* Convert a multibyte string to single-byte. */
9199 for (i = 0; i < nbytes; i += n) 9199 for (i = 0; i < nbytes; i += n)
@@ -9219,11 +9219,11 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9219 c = msg[i]; 9219 c = msg[i];
9220 MAKE_CHAR_MULTIBYTE (c); 9220 MAKE_CHAR_MULTIBYTE (c);
9221 n = CHAR_STRING (c, str); 9221 n = CHAR_STRING (c, str);
9222 insert_1_both (str, 1, n, 1, 0, 0); 9222 insert_1_both ((char *) str, 1, n, 1, 0, 0);
9223 } 9223 }
9224 } 9224 }
9225 else 9225 else
9226 insert_1 (msg, nbytes, 1, 0, 0); 9226 insert_1 (s, nbytes, 1, 0, 0);
9227 } 9227 }
9228 9228
9229 return 0; 9229 return 0;