void (*) (Lisp_Object, EMACS_INT,
EMACS_INT, EMACS_INT,
EMACS_INT, int),
- int, size_t, Lisp_Object *);
+ int, ptrdiff_t, Lisp_Object *);
static Lisp_Object subst_char_in_region_unwind (Lisp_Object);
static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object);
static void transpose_markers (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
usage: (char-to-string CHAR) */)
(Lisp_Object character)
{
- int len;
+ int c, len;
unsigned char str[MAX_MULTIBYTE_LENGTH];
CHECK_CHARACTER (character);
+ c = XFASTINT (character);
- len = CHAR_STRING (XFASTINT (character), str);
+ len = CHAR_STRING (c, str);
return make_string_from_bytes ((char *) str, 1, len);
}
year values as low as 1901 do work.
usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
time_t value;
struct tm tm;
void (*insert_from_string_func)
(Lisp_Object, EMACS_INT, EMACS_INT,
EMACS_INT, EMACS_INT, int),
- int inherit, size_t nargs, Lisp_Object *args)
+ int inherit, ptrdiff_t nargs, Lisp_Object *args)
{
- register size_t argnum;
+ ptrdiff_t argnum;
register Lisp_Object val;
for (argnum = 0; argnum < nargs; argnum++)
val = args[argnum];
if (CHARACTERP (val))
{
+ int c = XFASTINT (val);
unsigned char str[MAX_MULTIBYTE_LENGTH];
int len;
if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
- len = CHAR_STRING (XFASTINT (val), str);
+ len = CHAR_STRING (c, str);
else
{
- str[0] = (ASCII_CHAR_P (XINT (val))
- ? XINT (val)
- : multibyte_char_to_unibyte (XINT (val)));
+ str[0] = ASCII_CHAR_P (c) ? c : multibyte_char_to_unibyte (c);
len = 1;
}
(*insert_func) ((char *) str, len);
and insert the result.
usage: (insert &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
general_insert_function (insert, insert_from_string, 0, nargs, args);
return Qnil;
to unibyte for insertion.
usage: (insert-and-inherit &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
general_insert_function (insert_and_inherit, insert_from_string, 1,
nargs, args);
to unibyte for insertion.
usage: (insert-before-markers &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
general_insert_function (insert_before_markers,
insert_from_string_before_markers, 0,
to unibyte for insertion.
usage: (insert-before-markers-and-inherit &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
general_insert_function (insert_before_markers_and_inherit,
insert_from_string_before_markers, 1,
from adjoining text, if those properties are sticky. */)
(Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
{
- register char *string;
- register EMACS_INT stringlen;
- register int i;
+ int i, stringlen;
register EMACS_INT n;
- int len;
+ int c, len;
unsigned char str[MAX_MULTIBYTE_LENGTH];
+ char string[4000];
- CHECK_NUMBER (character);
+ CHECK_CHARACTER (character);
CHECK_NUMBER (count);
+ c = XFASTINT (character);
if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
- len = CHAR_STRING (XFASTINT (character), str);
+ len = CHAR_STRING (c, str);
else
- str[0] = XFASTINT (character), len = 1;
- if (MOST_POSITIVE_FIXNUM / len < XINT (count))
- error ("Maximum buffer size would be exceeded");
- n = XINT (count) * len;
- if (n <= 0)
+ str[0] = c, len = 1;
+ if (XINT (count) <= 0)
return Qnil;
- stringlen = min (n, 256 * len);
- string = (char *) alloca (stringlen);
+ if (BUF_BYTES_MAX / len < XINT (count))
+ buffer_overflow ();
+ n = XINT (count) * len;
+ stringlen = min (n, sizeof string - sizeof string % len);
for (i = 0; i < stringlen; i++)
string[i] = str[i % len];
- while (n >= stringlen)
+ while (n > stringlen)
{
QUIT;
if (!NILP (inherit))
insert (string, stringlen);
n -= stringlen;
}
- if (n > 0)
- {
- if (!NILP (inherit))
- insert_and_inherit (string, n);
- else
- insert (string, n);
- }
+ if (!NILP (inherit))
+ insert_and_inherit (string, n);
+ else
+ insert (string, n);
return Qnil;
}
int maybe_byte_combining = COMBINING_NO;
EMACS_INT last_changed = 0;
int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+ int fromc, toc;
restart:
validate_region (&start, &end);
- CHECK_NUMBER (fromchar);
- CHECK_NUMBER (tochar);
+ CHECK_CHARACTER (fromchar);
+ CHECK_CHARACTER (tochar);
+ fromc = XFASTINT (fromchar);
+ toc = XFASTINT (tochar);
if (multibyte_p)
{
- len = CHAR_STRING (XFASTINT (fromchar), fromstr);
- if (CHAR_STRING (XFASTINT (tochar), tostr) != len)
+ len = CHAR_STRING (fromc, fromstr);
+ if (CHAR_STRING (toc, tostr) != len)
error ("Characters in `subst-char-in-region' have different byte-lengths");
if (!ASCII_BYTE_P (*tostr))
{
else
{
len = 1;
- fromstr[0] = XFASTINT (fromchar);
- tostr[0] = XFASTINT (tochar);
+ fromstr[0] = fromc;
+ tostr[0] = toc;
}
pos = XINT (start);
}
else
{
- EMACS_INT c;
-
nc = oc;
val = CHAR_TABLE_REF (table, oc);
- if (CHARACTERP (val)
- && (c = XINT (val), CHAR_VALID_P (c, 0)))
+ if (CHARACTERP (val))
{
- nc = c;
+ nc = XFASTINT (val);
str_len = CHAR_STRING (nc, buf);
str = buf;
}
also `current-message'.
usage: (message FORMAT-STRING &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
if (NILP (args[0])
|| (STRINGP (args[0])
message; let the minibuffer contents show.
usage: (message-box FORMAT-STRING &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
if (NILP (args[0]))
{
message; let the minibuffer contents show.
usage: (message-or-box FORMAT-STRING &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
#ifdef HAVE_MENUS
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
Remaining arguments form a sequence of PROPERTY VALUE pairs for text
properties to add to the result.
usage: (propertize STRING &rest PROPERTIES) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object properties, string;
struct gcpro gcpro1, gcpro2;
- size_t i;
+ ptrdiff_t i;
/* Number of args must be odd. */
if ((nargs & 1) == 0)
specifier truncates the string to the given width.
usage: (format STRING &rest OBJECTS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
- EMACS_INT n; /* The number of the next arg to substitute */
+ ptrdiff_t n; /* The number of the next arg to substitute */
char initial_buffer[4000];
char *buf = initial_buffer;
EMACS_INT bufsize = sizeof initial_buffer;
- EMACS_INT max_bufsize = min (MOST_POSITIVE_FIXNUM + 1, SIZE_MAX);
+ EMACS_INT max_bufsize = STRING_BYTES_BOUND + 1;
char *p;
Lisp_Object buf_save_value IF_LINT (= {0});
register char *format, *end, *format_start;
/* Allocate the info and discarded tables. */
{
- EMACS_INT i;
+ ptrdiff_t i;
if ((SIZE_MAX - formatlen) / sizeof (struct info) <= nargs)
memory_full (SIZE_MAX);
SAFE_ALLOCA (info, struct info *, (nargs + 1) * sizeof *info + formatlen);
while (format != end)
{
/* The values of N and FORMAT when the loop body is entered. */
- EMACS_INT n0 = n;
+ ptrdiff_t n0 = n;
char *format0 = format;
/* Bytes needed to represent the output of this conversion. */
int exponent_bytes = 0;
int signedp = src0 == '-' || src0 == '+' || src0 == ' ';
int significand_bytes;
- if (zero_flag && '0' <= src[signedp] && src[signedp] <= '9')
+ if (zero_flag
+ && ((src[signedp] >= '0' && src[signedp] <= '9')
+ || (src[signedp] >= 'a' && src[signedp] <= 'f')
+ || (src[signedp] >= 'A' && src[signedp] <= 'F')))
{
leading_zeros += padding;
padding = 0;