* image.c (xbm_read_bitmap_data, xbm_load_image, xbm_load): Likewise.
* keyboard.c (echo_char, MULTI_LETTER_MOD, tty_read_avail_input):
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>
*p = tmp[0];
TEMP_SET_PT_BOTH (pos + 1, pos + 1);
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. */
pos = GPT;
p = GAP_END_ADDR;
else if (n > 1)
{
USE_SAFE_ALLOCA;
- unsigned char *strn, *p;
- SAFE_ALLOCA (strn, unsigned char*, n * len);
+ char *strn, *p;
+ SAFE_ALLOCA (strn, char *, n * len);
for (p = strn; n > 0; n--, p += len)
memcpy (p, str, len);
insert_and_inherit (strn, p - strn);
SAFE_FREE ();
}
else if (n > 0)
- insert_and_inherit (str, len);
+ insert_and_inherit ((char *) str, len);
if ((CHAR_TABLE_P (Vauto_fill_chars)
? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c))
initial_define_key (global_map, Ctl ('E'), "end-of-line");
initial_define_key (global_map, Ctl ('F'), "forward-char");
}
-
else if (BUFFERP (src_object))
insert_from_buffer (XBUFFER (src_object), from, chars, 0);
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))
{
static Lisp_Object region_limit (int);
static size_t emacs_nmemftime (char *, size_t, const char *,
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,
EMACS_INT, EMACS_INT,
EMACS_INT, int),
static void
general_insert_function (void (*insert_func)
- (const unsigned char *, EMACS_INT),
+ (const char *, EMACS_INT),
void (*insert_from_string_func)
(Lisp_Object, EMACS_INT, EMACS_INT,
EMACS_INT, EMACS_INT, int),
: multibyte_char_to_unibyte (XINT (val), Qnil));
len = 1;
}
- (*insert_func) (str, len);
+ (*insert_func) ((char *) str, len);
}
else if (STRINGP (val))
{
from adjoining text, if those properties are sticky. */)
(Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
{
- register unsigned char *string;
+ register char *string;
register EMACS_INT strlen;
register int i;
register EMACS_INT n;
if (n <= 0)
return Qnil;
strlen = min (n, 256 * len);
- string = (unsigned char *) alloca (strlen);
+ string = (char *) alloca (strlen);
for (i = 0; i < strlen; i++)
string[i] = str[i % len];
while (n >= strlen)
Ferase_buffer ();
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);
coding_system = call2 (Vset_auto_coding_function,
filename, make_number (nread));
prepare_to_modify_buffer could relocate the text. */
void
-insert (const unsigned char *string, EMACS_INT nbytes)
+insert (const char *string, EMACS_INT nbytes)
{
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);
opoint = PT - len;
signal_after_change (opoint, 0, len);
/* Likewise, but inherit text properties from neighboring characters. */
void
-insert_and_inherit (const unsigned char *string, EMACS_INT nbytes)
+insert_and_inherit (const char *string, EMACS_INT nbytes)
{
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);
opoint = PT - len;
signal_after_change (opoint, 0, len);
str[0] = c;
}
- insert (str, len);
+ insert ((char *) str, len);
}
/* Insert the null-terminated string S before point. */
since gc could happen and relocate it. */
void
-insert_before_markers (const unsigned char *string, EMACS_INT nbytes)
+insert_before_markers (const char *string, EMACS_INT nbytes)
{
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);
opoint = PT - len;
signal_after_change (opoint, 0, len);
/* Likewise, but inherit text properties from neighboring characters. */
void
-insert_before_markers_and_inherit (const unsigned char *string,
+insert_before_markers_and_inherit (const char *string,
EMACS_INT nbytes)
{
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);
opoint = PT - len;
signal_after_change (opoint, 0, len);
/* Subroutine used by the insert functions above. */
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)
{
- insert_1_both (string, chars_in_text (string, nbytes), nbytes,
- inherit, prepare, before_markers);
+ insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes),
+ nbytes, inherit, prepare, before_markers);
}
\f
are the same as in insert_1. */
void
-insert_1_both (const unsigned char *string,
+insert_1_both (const char *string,
EMACS_INT nchars, EMACS_INT nbytes,
int inherit, int prepare, int before_markers)
{
defsubr (&Scombine_after_change_execute);
}
-
EMACS_INT, EMACS_INT, EMACS_INT);
extern int count_combining_after (const unsigned char *,
EMACS_INT, EMACS_INT, EMACS_INT);
-extern void insert (const unsigned char *, EMACS_INT);
-extern void insert_and_inherit (const unsigned char *, EMACS_INT);
-extern void insert_1 (const unsigned char *, EMACS_INT, int, int, int);
-extern void insert_1_both (const unsigned char *, EMACS_INT, EMACS_INT,
+extern void insert (const char *, EMACS_INT);
+extern void insert_and_inherit (const char *, EMACS_INT);
+extern void insert_1 (const char *, EMACS_INT, int, int, int);
+extern void insert_1_both (const char *, EMACS_INT, EMACS_INT,
int, int, 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_buffer (struct buffer *, EMACS_INT, EMACS_INT, int);
extern void insert_char (int);
extern void insert_string (const char *);
-extern void insert_before_markers (const unsigned char *, EMACS_INT);
-extern void insert_before_markers_and_inherit (const unsigned char *,
- EMACS_INT);
+extern void insert_before_markers (const char *, EMACS_INT);
+extern void insert_before_markers_and_inherit (const char *, EMACS_INT);
extern void insert_from_string_before_markers (Lisp_Object, EMACS_INT,
EMACS_INT, EMACS_INT,
EMACS_INT, int);
= (unsigned char *) alloca (print_buffer_pos + 1); \
copy_text (print_buffer, temp, print_buffer_pos_byte, \
1, 0); \
- insert_1_both (temp, print_buffer_pos, \
+ insert_1_both ((char *) temp, print_buffer_pos, \
print_buffer_pos, 0, 1, 0); \
} \
else \
{
EMACS_INT i;
int c, char_bytes;
- unsigned char work[1];
+ char work[1];
/* Convert a multibyte string to single-byte
for the *Message* buffer. */
c = msg[i];
MAKE_CHAR_MULTIBYTE (c);
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)
- insert_1 (msg, nbytes, 1, 0, 0);
+ insert_1 (m, nbytes, 1, 0, 0);
if (nlflag)
{
EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte;
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);
this_bol = PT;
sprintf (dupstr, " [%d times]", dup);
duplen = strlen (dupstr);
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);
}
}
}
/* Convert from multi-byte to single-byte. */
EMACS_INT i;
int c, n;
- unsigned char work[1];
+ char work[1];
/* Convert a multibyte string to single-byte. */
for (i = 0; i < nbytes; i += n)
c = msg[i];
MAKE_CHAR_MULTIBYTE (c);
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
- insert_1 (msg, nbytes, 1, 0, 0);
+ insert_1 (s, nbytes, 1, 0, 0);
}
return 0;