aboutsummaryrefslogtreecommitdiffstats
path: root/src/print.c
diff options
context:
space:
mode:
authorPaul Eggert2019-07-07 12:29:27 -0700
committerPaul Eggert2019-07-07 12:33:35 -0700
commit8f522efe9a963cd3523ea6863f9bd44881cdf6b7 (patch)
tree10ba28c937e142395bcc4d81580d24fa334e1227 /src/print.c
parentbda8a57141e6cb5455e1246c6ab394791fd6c582 (diff)
downloademacs-8f522efe9a963cd3523ea6863f9bd44881cdf6b7.tar.gz
emacs-8f522efe9a963cd3523ea6863f9bd44881cdf6b7.zip
Remove printmax_t etc.
printmax_t etc. were needed only for platforms that lacked support for printing intmax_t. These platforms are now so obsolete that they are no longer practical porting targets. * src/image.c (gs_load): Fix unlikely buffer overrun discovered while making these changes. It was introduced in 2011-07-17T00:34:43!eggert@cs.ucla.edu. * src/lisp.h (printmax_t, uprintmax_t, pMd, pMu, pMx): Remove. All uses replaced by their standard counterparts intmax_t, uintmax_t, PRIdMAX, PRIuMAX, PRIxMAX.
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/print.c b/src/print.c
index 406abbf4a3f..dc44b1e89e0 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1017,8 +1017,8 @@ float_to_string (char *buf, double data)
1017 if (isnan (data)) 1017 if (isnan (data))
1018 { 1018 {
1019 union ieee754_double u = { .d = data }; 1019 union ieee754_double u = { .d = data };
1020 uprintmax_t hi = u.ieee_nan.mantissa0; 1020 uintmax_t hi = u.ieee_nan.mantissa0;
1021 return sprintf (buf, &"-%"pMu".0e+NaN"[!u.ieee_nan.negative], 1021 return sprintf (buf, &"-%"PRIuMAX".0e+NaN"[!u.ieee_nan.negative],
1022 (hi << 31 << 1) + u.ieee_nan.mantissa1); 1022 (hi << 31 << 1) + u.ieee_nan.mantissa1);
1023 } 1023 }
1024#endif 1024#endif
@@ -1811,9 +1811,9 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
1811 1811
1812 /* In theory this assignment could lose info on pre-C99 1812 /* In theory this assignment could lose info on pre-C99
1813 hosts, but in practice it doesn't. */ 1813 hosts, but in practice it doesn't. */
1814 uprintmax_t up = ui; 1814 uintmax_t up = ui;
1815 1815
1816 int len = sprintf (buf, "at 0x%"pMx, up); 1816 int len = sprintf (buf, "at 0x%"PRIxMAX, up);
1817 strout (buf, len, len, printcharfun); 1817 strout (buf, len, len, printcharfun);
1818 } 1818 }
1819 else 1819 else
@@ -1841,9 +1841,9 @@ static void
1841print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) 1841print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1842{ 1842{
1843 char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT), 1843 char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT),
1844 max (sizeof " . #" + INT_STRLEN_BOUND (printmax_t), 1844 max (sizeof " . #" + INT_STRLEN_BOUND (intmax_t),
1845 max ((sizeof "at 0x" 1845 max ((sizeof "at 0x"
1846 + (sizeof (uprintmax_t) * CHAR_BIT + 4 - 1) / 4), 1846 + (sizeof (uintmax_t) * CHAR_BIT + 4 - 1) / 4),
1847 40)))]; 1847 40)))];
1848 current_thread->stack_top = buf; 1848 current_thread->stack_top = buf;
1849 maybe_quit (); 1849 maybe_quit ();
@@ -2096,11 +2096,11 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
2096 2096
2097 /* Negative values of print-length are invalid in CL. 2097 /* Negative values of print-length are invalid in CL.
2098 Treat them like nil, as CMUCL does. */ 2098 Treat them like nil, as CMUCL does. */
2099 printmax_t print_length = (FIXNATP (Vprint_length) 2099 intmax_t print_length = (FIXNATP (Vprint_length)
2100 ? XFIXNAT (Vprint_length) 2100 ? XFIXNAT (Vprint_length)
2101 : TYPE_MAXIMUM (printmax_t)); 2101 : INTMAX_MAX);
2102 2102
2103 printmax_t i = 0; 2103 intmax_t i = 0;
2104 while (CONSP (obj)) 2104 while (CONSP (obj))
2105 { 2105 {
2106 /* Detect circular list. */ 2106 /* Detect circular list. */
@@ -2109,7 +2109,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
2109 /* Simple but incomplete way. */ 2109 /* Simple but incomplete way. */
2110 if (i != 0 && EQ (obj, halftail)) 2110 if (i != 0 && EQ (obj, halftail))
2111 { 2111 {
2112 int len = sprintf (buf, " . #%"pMd, i / 2); 2112 int len = sprintf (buf, " . #%"PRIdMAX, i >> 1);
2113 strout (buf, len, len, printcharfun); 2113 strout (buf, len, len, printcharfun);
2114 goto end_of_list; 2114 goto end_of_list;
2115 } 2115 }