aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1994-03-06 20:39:52 +0000
committerRichard M. Stallman <[email protected]>1994-03-06 20:39:52 +0000
commit9125da08de041b85d03a24c78be43e29eee9b128 (patch)
tree96688bc8c9cbeaafebe18f2c59e7754156380274 /src/eval.c
parent288f95bd036dc83326396c90d32679a3ecdeec6e (diff)
(error): Use doprnt. Make buffer larger as necessary.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index 02590e6e93..ea608d35a7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1302,12 +1302,38 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
void
error (m, a1, a2, a3)
char *m;
+ char *a1, *a2, *a3;
{
char buf[200];
- sprintf (buf, m, a1, a2, a3);
+ int size = 200;
+ int mlen;
+ char *buffer = buf;
+ char *args[3];
+ int allocated = 0;
+ Lisp_Object string;
+
+ args[0] = a1;
+ args[1] = a2;
+ args[2] = a3;
+
+ mlen = strlen (m);
while (1)
- Fsignal (Qerror, Fcons (build_string (buf), Qnil));
+ {
+ int used = doprnt (buf, size, m, m + mlen, 3, args);
+ if (used < size)
+ break;
+ size *= 2;
+ if (allocated)
+ buffer = (char *) xrealloc (buffer, size);
+ buffer = (char *) xmalloc (size);
+ }
+
+ string = build_string (buf);
+ if (allocated)
+ free (buffer);
+
+ Fsignal (Qerror, Fcons (string, Qnil));
}
DEFUN ("commandp", Fcommandp, Scommandp, 1, 1, 0,