; * src/lread.c (invalid_radix_integer): Use a local buffer.
This commit is contained in:
parent
3e5716dba3
commit
5cf7b1ada9
1 changed files with 10 additions and 12 deletions
22
src/lread.c
22
src/lread.c
|
@ -2905,20 +2905,18 @@ digit_to_number (int character, int base)
|
|||
return digit < base ? digit : -1;
|
||||
}
|
||||
|
||||
/* Size of the fixed-size buffer used during reading.
|
||||
It should be at least big enough for `invalid_radix_integer' but
|
||||
can usefully be much bigger than that. */
|
||||
enum { stackbufsize = 1024 };
|
||||
|
||||
static void
|
||||
invalid_radix_integer (EMACS_INT radix, char stackbuf[VLA_ELEMS (stackbufsize)],
|
||||
Lisp_Object readcharfun)
|
||||
invalid_radix_integer (EMACS_INT radix, Lisp_Object readcharfun)
|
||||
{
|
||||
int n = snprintf (stackbuf, stackbufsize, "integer, radix %"pI"d", radix);
|
||||
eassert (n < stackbufsize);
|
||||
invalid_syntax (stackbuf, readcharfun);
|
||||
char buf[64];
|
||||
int n = snprintf (buf, sizeof buf, "integer, radix %"pI"d", radix);
|
||||
eassert (n < sizeof buf);
|
||||
invalid_syntax (buf, readcharfun);
|
||||
}
|
||||
|
||||
/* Size of the fixed-size buffer used during reading. */
|
||||
enum { stackbufsize = 1024 };
|
||||
|
||||
/* Read an integer in radix RADIX using READCHARFUN to read
|
||||
characters. RADIX must be in the interval [2..36]. Use STACKBUF
|
||||
for temporary storage as needed. Value is the integer read.
|
||||
|
@ -2976,7 +2974,7 @@ read_integer (Lisp_Object readcharfun, int radix,
|
|||
UNREAD (c);
|
||||
|
||||
if (valid != 1)
|
||||
invalid_radix_integer (radix, stackbuf, readcharfun);
|
||||
invalid_radix_integer (radix, readcharfun);
|
||||
|
||||
*p = '\0';
|
||||
return unbind_to (count, string_to_number (read_buffer, radix, NULL));
|
||||
|
@ -3989,7 +3987,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
|
|||
{
|
||||
/* #NrDIGITS -- radix-N number */
|
||||
if (n < 0 || n > 36)
|
||||
invalid_radix_integer (n, stackbuf, readcharfun);
|
||||
invalid_radix_integer (n, readcharfun);
|
||||
obj = read_integer (readcharfun, n, stackbuf);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue