changeset 18342:913d2cc5a6aa

(Ferror_message_string): Optimize (error STRING) case.
author Richard M. Stallman <rms@gnu.org>
date Fri, 20 Jun 1997 08:45:37 +0000
parents 33e78cc7f058
children b5cee57a4a0f
files src/print.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/print.c	Fri Jun 20 06:30:29 1997 +0000
+++ b/src/print.c	Fri Jun 20 08:45:37 1997 +0000
@@ -727,6 +727,15 @@
   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));