# HG changeset patch # User Richard M. Stallman # Date 762986392 0 # Node ID 8f92cf89ed7c71b96fd2d4e3560c757f9c929326 # Parent a27c028e757aa789daa7aaf8e1a7600290f0b952 (error): Use doprnt. Make buffer larger as necessary. diff -r a27c028e757a -r 8f92cf89ed7c src/eval.c --- a/src/eval.c Sun Mar 06 19:43:23 1994 +0000 +++ b/src/eval.c Sun Mar 06 20:39:52 1994 +0000 @@ -1302,12 +1302,38 @@ 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,