aboutsummaryrefslogtreecommitdiffstats
path: root/src/print.c
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1997-06-20 08:45:37 +0000
committerRichard M. Stallman <[email protected]>1997-06-20 08:45:37 +0000
commit0872e11f1595845e7f3ba2c0d8e53ec7fc0f49e3 (patch)
tree21745bf057dcfa2fa6f1bd0903d2725afde1077a /src/print.c
parent75c8c59233cde6b0dedac7bd5ec33529a7ec1f56 (diff)
(Ferror_message_string): Optimize (error STRING) case.
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/print.c b/src/print.c
index 933544467c..6ac2b25745 100644
--- a/src/print.c
+++ b/src/print.c
@@ -727,6 +727,15 @@ DEFUN ("error-message-string", Ferror_message_string, Serror_message_string,
Lisp_Object original, printcharfun, value;
struct gcpro gcpro1;
+ /* If OBJ is (error STRING), just return STRING.
+ That is not only faster, it also avoids the need to allocate
+ space here when the error is due to memory full. */
+ if (CONSP (obj) && EQ (XCONS (obj)->car, Qerror)
+ && CONSP (XCONS (obj)->cdr)
+ && STRINGP (XCONS (XCONS (obj)->cdr)->car)
+ && NILP (XCONS (XCONS (obj)->cdr)->cdr))
+ return XCONS (XCONS (obj)->cdr)->car;
+
print_error_message (obj, Vprin1_to_string_buffer, NULL);
set_buffer_internal (XBUFFER (Vprin1_to_string_buffer));