aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias EngdegÄrd2022-08-30 11:57:29 +0200
committerMattias EngdegÄrd2022-08-30 16:24:21 +0200
commit5cf7b1ada96c2e209580d086d15b1bbe5b345657 (patch)
tree99117ad8abefa0e01d60b13946109ed703f9e43d /src
parent3e5716dba3ea203a4dc8be794a6b2dee13d5ecc4 (diff)
downloademacs-5cf7b1ada96c2e209580d086d15b1bbe5b345657.tar.gz
emacs-5cf7b1ada96c2e209580d086d15b1bbe5b345657.zip
; * src/lread.c (invalid_radix_integer): Use a local buffer.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/lread.c b/src/lread.c
index bb376064811..d64a4fad3af 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2905,20 +2905,18 @@ digit_to_number (int character, int base)
2905 return digit < base ? digit : -1; 2905 return digit < base ? digit : -1;
2906} 2906}
2907 2907
2908/* Size of the fixed-size buffer used during reading.
2909 It should be at least big enough for `invalid_radix_integer' but
2910 can usefully be much bigger than that. */
2911enum { stackbufsize = 1024 };
2912
2913static void 2908static void
2914invalid_radix_integer (EMACS_INT radix, char stackbuf[VLA_ELEMS (stackbufsize)], 2909invalid_radix_integer (EMACS_INT radix, Lisp_Object readcharfun)
2915 Lisp_Object readcharfun)
2916{ 2910{
2917 int n = snprintf (stackbuf, stackbufsize, "integer, radix %"pI"d", radix); 2911 char buf[64];
2918 eassert (n < stackbufsize); 2912 int n = snprintf (buf, sizeof buf, "integer, radix %"pI"d", radix);
2919 invalid_syntax (stackbuf, readcharfun); 2913 eassert (n < sizeof buf);
2914 invalid_syntax (buf, readcharfun);
2920} 2915}
2921 2916
2917/* Size of the fixed-size buffer used during reading. */
2918enum { stackbufsize = 1024 };
2919
2922/* Read an integer in radix RADIX using READCHARFUN to read 2920/* Read an integer in radix RADIX using READCHARFUN to read
2923 characters. RADIX must be in the interval [2..36]. Use STACKBUF 2921 characters. RADIX must be in the interval [2..36]. Use STACKBUF
2924 for temporary storage as needed. Value is the integer read. 2922 for temporary storage as needed. Value is the integer read.
@@ -2976,7 +2974,7 @@ read_integer (Lisp_Object readcharfun, int radix,
2976 UNREAD (c); 2974 UNREAD (c);
2977 2975
2978 if (valid != 1) 2976 if (valid != 1)
2979 invalid_radix_integer (radix, stackbuf, readcharfun); 2977 invalid_radix_integer (radix, readcharfun);
2980 2978
2981 *p = '\0'; 2979 *p = '\0';
2982 return unbind_to (count, string_to_number (read_buffer, radix, NULL)); 2980 return unbind_to (count, string_to_number (read_buffer, radix, NULL));
@@ -3989,7 +3987,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
3989 { 3987 {
3990 /* #NrDIGITS -- radix-N number */ 3988 /* #NrDIGITS -- radix-N number */
3991 if (n < 0 || n > 36) 3989 if (n < 0 || n > 36)
3992 invalid_radix_integer (n, stackbuf, readcharfun); 3990 invalid_radix_integer (n, readcharfun);
3993 obj = read_integer (readcharfun, n, stackbuf); 3991 obj = read_integer (readcharfun, n, stackbuf);
3994 break; 3992 break;
3995 } 3993 }