diff options
| author | Richard M. Stallman | 1994-03-06 20:39:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-06 20:39:52 +0000 |
| commit | 9125da08de041b85d03a24c78be43e29eee9b128 (patch) | |
| tree | 96688bc8c9cbeaafebe18f2c59e7754156380274 /src | |
| parent | 288f95bd036dc83326396c90d32679a3ecdeec6e (diff) | |
| download | emacs-9125da08de041b85d03a24c78be43e29eee9b128.tar.gz emacs-9125da08de041b85d03a24c78be43e29eee9b128.zip | |
(error): Use doprnt. Make buffer larger as necessary.
Diffstat (limited to 'src')
| -rw-r--r-- | src/eval.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index 02590e6e938..ea608d35a78 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -1302,12 +1302,38 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) | |||
| 1302 | void | 1302 | void |
| 1303 | error (m, a1, a2, a3) | 1303 | error (m, a1, a2, a3) |
| 1304 | char *m; | 1304 | char *m; |
| 1305 | char *a1, *a2, *a3; | ||
| 1305 | { | 1306 | { |
| 1306 | char buf[200]; | 1307 | char buf[200]; |
| 1307 | sprintf (buf, m, a1, a2, a3); | 1308 | int size = 200; |
| 1309 | int mlen; | ||
| 1310 | char *buffer = buf; | ||
| 1311 | char *args[3]; | ||
| 1312 | int allocated = 0; | ||
| 1313 | Lisp_Object string; | ||
| 1314 | |||
| 1315 | args[0] = a1; | ||
| 1316 | args[1] = a2; | ||
| 1317 | args[2] = a3; | ||
| 1318 | |||
| 1319 | mlen = strlen (m); | ||
| 1308 | 1320 | ||
| 1309 | while (1) | 1321 | while (1) |
| 1310 | Fsignal (Qerror, Fcons (build_string (buf), Qnil)); | 1322 | { |
| 1323 | int used = doprnt (buf, size, m, m + mlen, 3, args); | ||
| 1324 | if (used < size) | ||
| 1325 | break; | ||
| 1326 | size *= 2; | ||
| 1327 | if (allocated) | ||
| 1328 | buffer = (char *) xrealloc (buffer, size); | ||
| 1329 | buffer = (char *) xmalloc (size); | ||
| 1330 | } | ||
| 1331 | |||
| 1332 | string = build_string (buf); | ||
| 1333 | if (allocated) | ||
| 1334 | free (buffer); | ||
| 1335 | |||
| 1336 | Fsignal (Qerror, Fcons (string, Qnil)); | ||
| 1311 | } | 1337 | } |
| 1312 | 1338 | ||
| 1313 | DEFUN ("commandp", Fcommandp, Scommandp, 1, 1, 0, | 1339 | DEFUN ("commandp", Fcommandp, Scommandp, 1, 1, 0, |