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 | 7579c7fdd5951999b7233d5db044ade6a82ec272 (patch) | |
tree | 5cb84003d2c47cda6938e7df2ff2dcbc75c58b29 | |
parent | dd7280eee77dde3f98d3161c645a2277385546ba (diff) | |
download | txr-7579c7fdd5951999b7233d5db044ade6a82ec272.tar.gz txr-7579c7fdd5951999b7233d5db044ade6a82ec272.tar.bz2 txr-7579c7fdd5951999b7233d5db044ade6a82ec272.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)); |