* insdel.c: conform to C89 pointer rules
This commit is contained in:
parent
f8b351c190
commit
b68864e5b9
10 changed files with 46 additions and 42 deletions
|
@ -17,6 +17,13 @@
|
||||||
* image.c (xbm_read_bitmap_data, xbm_load_image, xbm_load): Likewise.
|
* image.c (xbm_read_bitmap_data, xbm_load_image, xbm_load): Likewise.
|
||||||
* keyboard.c (echo_char, MULTI_LETTER_MOD, tty_read_avail_input):
|
* keyboard.c (echo_char, MULTI_LETTER_MOD, tty_read_avail_input):
|
||||||
Likewise.
|
Likewise.
|
||||||
|
* insdel.c (insert, insert_and_inherit, insert_before_markers):
|
||||||
|
(insert_before_markers_and_inherit, insert_1, insert_1_both):
|
||||||
|
Likewise. This changes these functions' signatures, which is
|
||||||
|
more convenient since most callers use char *. All remaining
|
||||||
|
callers changed.
|
||||||
|
* editfns.c (general_insert_function): Change signature to
|
||||||
|
match changes to insert functions' signatures.
|
||||||
|
|
||||||
2011-02-05 Paul Eggert <eggert@cs.ucla.edu>
|
2011-02-05 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
|
|
|
@ -2401,7 +2401,7 @@ current buffer is cleared. */)
|
||||||
*p = tmp[0];
|
*p = tmp[0];
|
||||||
TEMP_SET_PT_BOTH (pos + 1, pos + 1);
|
TEMP_SET_PT_BOTH (pos + 1, pos + 1);
|
||||||
bytes--;
|
bytes--;
|
||||||
insert_1_both (tmp + 1, bytes, bytes, 1, 0, 0);
|
insert_1_both ((char *) tmp + 1, bytes, bytes, 1, 0, 0);
|
||||||
/* Now the gap is after the just inserted data. */
|
/* Now the gap is after the just inserted data. */
|
||||||
pos = GPT;
|
pos = GPT;
|
||||||
p = GAP_END_ADDR;
|
p = GAP_END_ADDR;
|
||||||
|
|
|
@ -466,15 +466,15 @@ internal_self_insert (int c, EMACS_INT n)
|
||||||
else if (n > 1)
|
else if (n > 1)
|
||||||
{
|
{
|
||||||
USE_SAFE_ALLOCA;
|
USE_SAFE_ALLOCA;
|
||||||
unsigned char *strn, *p;
|
char *strn, *p;
|
||||||
SAFE_ALLOCA (strn, unsigned char*, n * len);
|
SAFE_ALLOCA (strn, char *, n * len);
|
||||||
for (p = strn; n > 0; n--, p += len)
|
for (p = strn; n > 0; n--, p += len)
|
||||||
memcpy (p, str, len);
|
memcpy (p, str, len);
|
||||||
insert_and_inherit (strn, p - strn);
|
insert_and_inherit (strn, p - strn);
|
||||||
SAFE_FREE ();
|
SAFE_FREE ();
|
||||||
}
|
}
|
||||||
else if (n > 0)
|
else if (n > 0)
|
||||||
insert_and_inherit (str, len);
|
insert_and_inherit ((char *) str, len);
|
||||||
|
|
||||||
if ((CHAR_TABLE_P (Vauto_fill_chars)
|
if ((CHAR_TABLE_P (Vauto_fill_chars)
|
||||||
? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c))
|
? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c))
|
||||||
|
@ -559,4 +559,3 @@ keys_of_cmds (void)
|
||||||
initial_define_key (global_map, Ctl ('E'), "end-of-line");
|
initial_define_key (global_map, Ctl ('E'), "end-of-line");
|
||||||
initial_define_key (global_map, Ctl ('F'), "forward-char");
|
initial_define_key (global_map, Ctl ('F'), "forward-char");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7880,7 +7880,7 @@ encode_coding_object (struct coding_system *coding,
|
||||||
else if (BUFFERP (src_object))
|
else if (BUFFERP (src_object))
|
||||||
insert_from_buffer (XBUFFER (src_object), from, chars, 0);
|
insert_from_buffer (XBUFFER (src_object), from, chars, 0);
|
||||||
else
|
else
|
||||||
insert_1_both (coding->source + from, chars, bytes, 0, 0, 0);
|
insert_1_both ((char *) coding->source + from, chars, bytes, 0, 0, 0);
|
||||||
|
|
||||||
if (EQ (src_object, dst_object))
|
if (EQ (src_object, dst_object))
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,7 @@ static void update_buffer_properties (EMACS_INT, EMACS_INT);
|
||||||
static Lisp_Object region_limit (int);
|
static Lisp_Object region_limit (int);
|
||||||
static size_t emacs_nmemftime (char *, size_t, const char *,
|
static size_t emacs_nmemftime (char *, size_t, const char *,
|
||||||
size_t, const struct tm *, int, int);
|
size_t, const struct tm *, int, int);
|
||||||
static void general_insert_function (void (*) (const unsigned char *, EMACS_INT),
|
static void general_insert_function (void (*) (const char *, EMACS_INT),
|
||||||
void (*) (Lisp_Object, EMACS_INT,
|
void (*) (Lisp_Object, EMACS_INT,
|
||||||
EMACS_INT, EMACS_INT,
|
EMACS_INT, EMACS_INT,
|
||||||
EMACS_INT, int),
|
EMACS_INT, int),
|
||||||
|
@ -2118,7 +2118,7 @@ set_time_zone_rule (const char *tzstring)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
general_insert_function (void (*insert_func)
|
general_insert_function (void (*insert_func)
|
||||||
(const unsigned char *, EMACS_INT),
|
(const char *, EMACS_INT),
|
||||||
void (*insert_from_string_func)
|
void (*insert_from_string_func)
|
||||||
(Lisp_Object, EMACS_INT, EMACS_INT,
|
(Lisp_Object, EMACS_INT, EMACS_INT,
|
||||||
EMACS_INT, EMACS_INT, int),
|
EMACS_INT, EMACS_INT, int),
|
||||||
|
@ -2144,7 +2144,7 @@ general_insert_function (void (*insert_func)
|
||||||
: multibyte_char_to_unibyte (XINT (val), Qnil));
|
: multibyte_char_to_unibyte (XINT (val), Qnil));
|
||||||
len = 1;
|
len = 1;
|
||||||
}
|
}
|
||||||
(*insert_func) (str, len);
|
(*insert_func) ((char *) str, len);
|
||||||
}
|
}
|
||||||
else if (STRINGP (val))
|
else if (STRINGP (val))
|
||||||
{
|
{
|
||||||
|
@ -2257,7 +2257,7 @@ The optional third arg INHERIT, if non-nil, says to inherit text properties
|
||||||
from adjoining text, if those properties are sticky. */)
|
from adjoining text, if those properties are sticky. */)
|
||||||
(Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
|
(Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
|
||||||
{
|
{
|
||||||
register unsigned char *string;
|
register char *string;
|
||||||
register EMACS_INT strlen;
|
register EMACS_INT strlen;
|
||||||
register int i;
|
register int i;
|
||||||
register EMACS_INT n;
|
register EMACS_INT n;
|
||||||
|
@ -2277,7 +2277,7 @@ from adjoining text, if those properties are sticky. */)
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
strlen = min (n, 256 * len);
|
strlen = min (n, 256 * len);
|
||||||
string = (unsigned char *) alloca (strlen);
|
string = (char *) alloca (strlen);
|
||||||
for (i = 0; i < strlen; i++)
|
for (i = 0; i < strlen; i++)
|
||||||
string[i] = str[i % len];
|
string[i] = str[i % len];
|
||||||
while (n >= strlen)
|
while (n >= strlen)
|
||||||
|
|
|
@ -3412,7 +3412,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
|
||||||
Ferase_buffer ();
|
Ferase_buffer ();
|
||||||
buf->enable_multibyte_characters = Qnil;
|
buf->enable_multibyte_characters = Qnil;
|
||||||
|
|
||||||
insert_1_both (read_buf, nread, nread, 0, 0, 0);
|
insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
|
||||||
TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
|
TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
|
||||||
coding_system = call2 (Vset_auto_coding_function,
|
coding_system = call2 (Vset_auto_coding_function,
|
||||||
filename, make_number (nread));
|
filename, make_number (nread));
|
||||||
|
|
27
src/insdel.c
27
src/insdel.c
|
@ -668,11 +668,11 @@ count_size_as_multibyte (const unsigned char *ptr, EMACS_INT nbytes)
|
||||||
prepare_to_modify_buffer could relocate the text. */
|
prepare_to_modify_buffer could relocate the text. */
|
||||||
|
|
||||||
void
|
void
|
||||||
insert (const unsigned char *string, EMACS_INT nbytes)
|
insert (const char *string, EMACS_INT nbytes)
|
||||||
{
|
{
|
||||||
if (nbytes > 0)
|
if (nbytes > 0)
|
||||||
{
|
{
|
||||||
EMACS_INT len = chars_in_text (string, nbytes), opoint;
|
EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
|
||||||
insert_1_both (string, len, nbytes, 0, 1, 0);
|
insert_1_both (string, len, nbytes, 0, 1, 0);
|
||||||
opoint = PT - len;
|
opoint = PT - len;
|
||||||
signal_after_change (opoint, 0, len);
|
signal_after_change (opoint, 0, len);
|
||||||
|
@ -683,11 +683,11 @@ insert (const unsigned char *string, EMACS_INT nbytes)
|
||||||
/* Likewise, but inherit text properties from neighboring characters. */
|
/* Likewise, but inherit text properties from neighboring characters. */
|
||||||
|
|
||||||
void
|
void
|
||||||
insert_and_inherit (const unsigned char *string, EMACS_INT nbytes)
|
insert_and_inherit (const char *string, EMACS_INT nbytes)
|
||||||
{
|
{
|
||||||
if (nbytes > 0)
|
if (nbytes > 0)
|
||||||
{
|
{
|
||||||
EMACS_INT len = chars_in_text (string, nbytes), opoint;
|
EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
|
||||||
insert_1_both (string, len, nbytes, 1, 1, 0);
|
insert_1_both (string, len, nbytes, 1, 1, 0);
|
||||||
opoint = PT - len;
|
opoint = PT - len;
|
||||||
signal_after_change (opoint, 0, len);
|
signal_after_change (opoint, 0, len);
|
||||||
|
@ -711,7 +711,7 @@ insert_char (int c)
|
||||||
str[0] = c;
|
str[0] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
insert (str, len);
|
insert ((char *) str, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert the null-terminated string S before point. */
|
/* Insert the null-terminated string S before point. */
|
||||||
|
@ -728,11 +728,11 @@ insert_string (const char *s)
|
||||||
since gc could happen and relocate it. */
|
since gc could happen and relocate it. */
|
||||||
|
|
||||||
void
|
void
|
||||||
insert_before_markers (const unsigned char *string, EMACS_INT nbytes)
|
insert_before_markers (const char *string, EMACS_INT nbytes)
|
||||||
{
|
{
|
||||||
if (nbytes > 0)
|
if (nbytes > 0)
|
||||||
{
|
{
|
||||||
EMACS_INT len = chars_in_text (string, nbytes), opoint;
|
EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
|
||||||
insert_1_both (string, len, nbytes, 0, 1, 1);
|
insert_1_both (string, len, nbytes, 0, 1, 1);
|
||||||
opoint = PT - len;
|
opoint = PT - len;
|
||||||
signal_after_change (opoint, 0, len);
|
signal_after_change (opoint, 0, len);
|
||||||
|
@ -743,12 +743,12 @@ insert_before_markers (const unsigned char *string, EMACS_INT nbytes)
|
||||||
/* Likewise, but inherit text properties from neighboring characters. */
|
/* Likewise, but inherit text properties from neighboring characters. */
|
||||||
|
|
||||||
void
|
void
|
||||||
insert_before_markers_and_inherit (const unsigned char *string,
|
insert_before_markers_and_inherit (const char *string,
|
||||||
EMACS_INT nbytes)
|
EMACS_INT nbytes)
|
||||||
{
|
{
|
||||||
if (nbytes > 0)
|
if (nbytes > 0)
|
||||||
{
|
{
|
||||||
EMACS_INT len = chars_in_text (string, nbytes), opoint;
|
EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
|
||||||
insert_1_both (string, len, nbytes, 1, 1, 1);
|
insert_1_both (string, len, nbytes, 1, 1, 1);
|
||||||
opoint = PT - len;
|
opoint = PT - len;
|
||||||
signal_after_change (opoint, 0, len);
|
signal_after_change (opoint, 0, len);
|
||||||
|
@ -759,11 +759,11 @@ insert_before_markers_and_inherit (const unsigned char *string,
|
||||||
/* Subroutine used by the insert functions above. */
|
/* Subroutine used by the insert functions above. */
|
||||||
|
|
||||||
void
|
void
|
||||||
insert_1 (const unsigned char *string, EMACS_INT nbytes,
|
insert_1 (const char *string, EMACS_INT nbytes,
|
||||||
int inherit, int prepare, int before_markers)
|
int inherit, int prepare, int before_markers)
|
||||||
{
|
{
|
||||||
insert_1_both (string, chars_in_text (string, nbytes), nbytes,
|
insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes),
|
||||||
inherit, prepare, before_markers);
|
nbytes, inherit, prepare, before_markers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -884,7 +884,7 @@ count_combining_after (const unsigned char *string,
|
||||||
are the same as in insert_1. */
|
are the same as in insert_1. */
|
||||||
|
|
||||||
void
|
void
|
||||||
insert_1_both (const unsigned char *string,
|
insert_1_both (const char *string,
|
||||||
EMACS_INT nchars, EMACS_INT nbytes,
|
EMACS_INT nchars, EMACS_INT nbytes,
|
||||||
int inherit, int prepare, int before_markers)
|
int inherit, int prepare, int before_markers)
|
||||||
{
|
{
|
||||||
|
@ -2382,4 +2382,3 @@ as well as hooks attached to text properties and overlays. */);
|
||||||
|
|
||||||
defsubr (&Scombine_after_change_execute);
|
defsubr (&Scombine_after_change_execute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
src/lisp.h
13
src/lisp.h
|
@ -2555,10 +2555,10 @@ extern int count_combining_before (const unsigned char *,
|
||||||
EMACS_INT, EMACS_INT, EMACS_INT);
|
EMACS_INT, EMACS_INT, EMACS_INT);
|
||||||
extern int count_combining_after (const unsigned char *,
|
extern int count_combining_after (const unsigned char *,
|
||||||
EMACS_INT, EMACS_INT, EMACS_INT);
|
EMACS_INT, EMACS_INT, EMACS_INT);
|
||||||
extern void insert (const unsigned char *, EMACS_INT);
|
extern void insert (const char *, EMACS_INT);
|
||||||
extern void insert_and_inherit (const unsigned char *, EMACS_INT);
|
extern void insert_and_inherit (const char *, EMACS_INT);
|
||||||
extern void insert_1 (const unsigned char *, EMACS_INT, int, int, int);
|
extern void insert_1 (const char *, EMACS_INT, int, int, int);
|
||||||
extern void insert_1_both (const unsigned char *, EMACS_INT, EMACS_INT,
|
extern void insert_1_both (const char *, EMACS_INT, EMACS_INT,
|
||||||
int, int, int);
|
int, int, int);
|
||||||
extern void insert_from_gap (EMACS_INT, EMACS_INT);
|
extern void insert_from_gap (EMACS_INT, EMACS_INT);
|
||||||
extern void insert_from_string (Lisp_Object, EMACS_INT, EMACS_INT,
|
extern 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,
|
||||||
extern void insert_from_buffer (struct buffer *, EMACS_INT, EMACS_INT, int);
|
extern void insert_from_buffer (struct buffer *, EMACS_INT, EMACS_INT, int);
|
||||||
extern void insert_char (int);
|
extern void insert_char (int);
|
||||||
extern void insert_string (const char *);
|
extern void insert_string (const char *);
|
||||||
extern void insert_before_markers (const unsigned char *, EMACS_INT);
|
extern void insert_before_markers (const char *, EMACS_INT);
|
||||||
extern void insert_before_markers_and_inherit (const unsigned char *,
|
extern void insert_before_markers_and_inherit (const char *, EMACS_INT);
|
||||||
EMACS_INT);
|
|
||||||
extern void insert_from_string_before_markers (Lisp_Object, EMACS_INT,
|
extern void insert_from_string_before_markers (Lisp_Object, EMACS_INT,
|
||||||
EMACS_INT, EMACS_INT,
|
EMACS_INT, EMACS_INT,
|
||||||
EMACS_INT, int);
|
EMACS_INT, int);
|
||||||
|
|
|
@ -179,7 +179,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
|
||||||
= (unsigned char *) alloca (print_buffer_pos + 1); \
|
= (unsigned char *) alloca (print_buffer_pos + 1); \
|
||||||
copy_text (print_buffer, temp, print_buffer_pos_byte, \
|
copy_text (print_buffer, temp, print_buffer_pos_byte, \
|
||||||
1, 0); \
|
1, 0); \
|
||||||
insert_1_both (temp, print_buffer_pos, \
|
insert_1_both ((char *) temp, print_buffer_pos, \
|
||||||
print_buffer_pos, 0, 1, 0); \
|
print_buffer_pos, 0, 1, 0); \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
|
|
16
src/xdisp.c
16
src/xdisp.c
|
@ -7930,7 +7930,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
|
||||||
{
|
{
|
||||||
EMACS_INT i;
|
EMACS_INT i;
|
||||||
int c, char_bytes;
|
int c, char_bytes;
|
||||||
unsigned char work[1];
|
char work[1];
|
||||||
|
|
||||||
/* Convert a multibyte string to single-byte
|
/* Convert a multibyte string to single-byte
|
||||||
for the *Message* buffer. */
|
for the *Message* buffer. */
|
||||||
|
@ -7956,17 +7956,17 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
|
||||||
c = msg[i];
|
c = msg[i];
|
||||||
MAKE_CHAR_MULTIBYTE (c);
|
MAKE_CHAR_MULTIBYTE (c);
|
||||||
char_bytes = CHAR_STRING (c, str);
|
char_bytes = CHAR_STRING (c, str);
|
||||||
insert_1_both (str, 1, char_bytes, 1, 0, 0);
|
insert_1_both ((char *) str, 1, char_bytes, 1, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nbytes)
|
else if (nbytes)
|
||||||
insert_1 (msg, nbytes, 1, 0, 0);
|
insert_1 (m, nbytes, 1, 0, 0);
|
||||||
|
|
||||||
if (nlflag)
|
if (nlflag)
|
||||||
{
|
{
|
||||||
EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte;
|
EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte;
|
||||||
int dup;
|
int dup;
|
||||||
insert_1 ((const unsigned char *) "\n", 1, 1, 0, 0);
|
insert_1 ("\n", 1, 1, 0, 0);
|
||||||
|
|
||||||
scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0);
|
scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0);
|
||||||
this_bol = PT;
|
this_bol = PT;
|
||||||
|
@ -7996,7 +7996,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
|
||||||
sprintf (dupstr, " [%d times]", dup);
|
sprintf (dupstr, " [%d times]", dup);
|
||||||
duplen = strlen (dupstr);
|
duplen = strlen (dupstr);
|
||||||
TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1);
|
TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1);
|
||||||
insert_1 ((unsigned char *) dupstr, duplen, 1, 0, 1);
|
insert_1 (dupstr, duplen, 1, 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9193,7 +9193,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
|
||||||
/* Convert from multi-byte to single-byte. */
|
/* Convert from multi-byte to single-byte. */
|
||||||
EMACS_INT i;
|
EMACS_INT i;
|
||||||
int c, n;
|
int c, n;
|
||||||
unsigned char work[1];
|
char work[1];
|
||||||
|
|
||||||
/* Convert a multibyte string to single-byte. */
|
/* Convert a multibyte string to single-byte. */
|
||||||
for (i = 0; i < nbytes; i += n)
|
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
|
||||||
c = msg[i];
|
c = msg[i];
|
||||||
MAKE_CHAR_MULTIBYTE (c);
|
MAKE_CHAR_MULTIBYTE (c);
|
||||||
n = CHAR_STRING (c, str);
|
n = CHAR_STRING (c, str);
|
||||||
insert_1_both (str, 1, n, 1, 0, 0);
|
insert_1_both ((char *) str, 1, n, 1, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
insert_1 (msg, nbytes, 1, 0, 0);
|
insert_1 (s, nbytes, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue