From 7579c7fdd5951999b7233d5db044ade6a82ec272 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 31 Oct 2016 21:41:53 -0700 Subject: Don't enter symbols into cycle-identifying hash. * lib.c (circle_print_eligible): New inline function. (obj_print_impl): Do not bother with hash lookup for interned objects that don't participate in circle notation. (populate_obj_hash): Replace open-coded test with call to circle_print_eligible. --- lib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib.c b/lib.c index 05541f5d..7b67c4d1 100644 --- a/lib.c +++ b/lib.c @@ -9209,11 +9209,16 @@ static void out_quasi_str(val args, val out, struct strm_ctx *ctx) } } +INLINE int circle_print_eligible(val obj) +{ + return is_ptr(obj) && (!symbolp(obj) || !symbol_package(obj)); +} + val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx) { val ret = obj; - if (ctx && is_ptr(obj)) { + if (ctx && circle_print_eligible(obj)) { val cell = gethash_c(ctx->obj_hash, obj, nulloc); val label = cdr(cell); @@ -9515,7 +9520,7 @@ dot: static void populate_obj_hash(val obj, struct strm_ctx *ctx) { tail: - if (is_ptr(obj) && (!symbolp(obj) || !symbol_package(obj))) { + if (circle_print_eligible(obj)) { val new_p; val cell = gethash_c(ctx->obj_hash, obj, mkcloc(new_p)); -- cgit v1.2.3