From 598d0f72f5d9971d9c36aa346b6bc31e1955c396 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 8 Nov 2021 07:15:53 -0800 Subject: hash: spurious space in printed representation. * hash.c (hash_print_op): Only set the need_space flag if some leading item is printed. --- hash.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hash.c b/hash.c index 54ebc9dc..2a85d2f6 100644 --- a/hash.c +++ b/hash.c @@ -510,17 +510,21 @@ static void hash_print_op(val hash, val out, val pretty, struct strm_ctx *ctx) put_char(chr('('), out); if (opt_compat && opt_compat <= 188) { - if (h->hops == &hash_eq_ops) + if (h->hops == &hash_eq_ops) { obj_print_impl(eq_based_k, out, pretty, ctx); - else if (h->hops == &hash_equal_ops) + need_space = 1; + } else if (h->hops == &hash_equal_ops) { obj_print_impl(equal_based_k, out, pretty, ctx); - need_space = 1; + need_space = 1; + } } else { - if (h->hops == &hash_eql_ops) + if (h->hops == &hash_eql_ops) { obj_print_impl(eql_based_k, out, pretty, ctx); - else if (h->hops == &hash_eq_ops) + need_space = 1; + } else if (h->hops == &hash_eq_ops) { obj_print_impl(eq_based_k, out, pretty, ctx); - need_space = 1; + need_space = 1; + } } if (h->wkopt != hash_weak_none) { -- cgit v1.2.3