* boot-9.scm (struct-printer): Bugfix: Check the layout of the
authorMarius Vollmer <mvo@zagadka.de>
Fri, 6 Jun 1997 15:14:55 +0000 (15:14 +0000)
committerMarius Vollmer <mvo@zagadka.de>
Fri, 6 Jun 1997 15:14:55 +0000 (15:14 +0000)
vtable and not the one of the struct.

ice-9/boot-9.scm

index 03bd5ef..7cc4a41 100644 (file)
 (define %struct-printer-tag (cons '%struct-printer-tag #f))
 
 (define (struct-printer s)
-  (and (>= (string-length (struct-layout s))
-          (* 2 struct-vtable-offset))
-       (let ((p (struct-ref (struct-vtable s) struct-vtable-offset)))
-        (and (eq? (car p) %struct-printer-tag)
-             (cdr p)))))
+  (let ((vtable (struct-vtable s)))
+    (and (>= (string-length (struct-layout vtable))
+            (* 2 struct-vtable-offset))
+        (let ((p (struct-ref vtable struct-vtable-offset)))
+          (and (eq? (car p) %struct-printer-tag)
+               (cdr p))))))
 
 (define (make-struct-printer printer)
   (cons %struct-printer-tag printer))