aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorEli Zaretskii2011-04-25 11:04:22 +0300
committerEli Zaretskii2011-04-25 11:04:22 +0300
commit825cd63ca98121d602b4a8dcffa55d29841224a0 (patch)
tree0ecfbd1149dd944fb7b77132ef8ef0c6201d9180 /src/eval.c
parente2822bd2ea32c577342b9618a301f8661551f7a3 (diff)
downloademacs-825cd63ca98121d602b4a8dcffa55d29841224a0.tar.gz
emacs-825cd63ca98121d602b4a8dcffa55d29841224a0.zip
Improve doprnt and its use in verror. (Bug#8545)
src/doprnt.c (doprnt): Document the set of format control sequences supported by the function. Use SAFE_ALLOCA instead of always using `alloca'. src/eval.c (verror): Don't limit the buffer size at size_max-1, that is one byte too soon. Don't use xrealloc; instead xfree and xmalloc anew.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c
index c3676720940..d1f327021e6 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2012,15 +2012,14 @@ verror (const char *m, va_list ap)
2012 break; 2012 break;
2013 if (size <= size_max / 2) 2013 if (size <= size_max / 2)
2014 size *= 2; 2014 size *= 2;
2015 else if (size < size_max - 1) 2015 else if (size < size_max)
2016 size = size_max - 1; 2016 size = size_max;
2017 else 2017 else
2018 break; /* and leave the message truncated */ 2018 break; /* and leave the message truncated */
2019 2019
2020 if (buffer == buf) 2020 if (buffer != buf)
2021 buffer = (char *) xmalloc (size); 2021 xfree (buffer);
2022 else 2022 buffer = (char *) xmalloc (size);
2023 buffer = (char *) xrealloc (buffer, size);
2024 } 2023 }
2025 2024
2026 string = make_string (buffer, used); 2025 string = make_string (buffer, used);