diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-10-31 21:41:53 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-10-31 21:41:53 -0700 |
commit | aed4c55e415754df64073565e3b9c4979d033370 (patch) | |
tree | 5cb84003d2c47cda6938e7df2ff2dcbc75c58b29 | |
parent | 5d9e217bb248015823c948010c1f0b47efe2cdb4 (diff) | |
download | txr-aed4c55e415754df64073565e3b9c4979d033370.tar.gz txr-aed4c55e415754df64073565e3b9c4979d033370.tar.bz2 txr-aed4c55e415754df64073565e3b9c4979d033370.zip |
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.
-rw-r--r-- | lib.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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)); |