summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-01-15 12:42:19 -0800
committerKaz Kylheku <kaz@kylheku.com>2025-01-15 12:42:19 -0800
commit23adf30aa61e913b7cd221c9ecdf510d1a79d125 (patch)
treeb8e1582b38e474d0f0d31c63c0a7873984dc8eb9
parent58cf667aa73134c7945b0be77ed92f1c8fbc5be9 (diff)
downloadtxr-23adf30aa61e913b7cd221c9ecdf510d1a79d125.tar.gz
txr-23adf30aa61e913b7cd221c9ecdf510d1a79d125.tar.bz2
txr-23adf30aa61e913b7cd221c9ecdf510d1a79d125.zip
put_json: bug: incorrect defaulting of flat argument.
this also affects put_jsonl and tojson. * lib.c (put_json): The flat argument must be properly defaulted. Without this we are treating it as true when it is missing due to the convention that missing args are signaled by the : symbol. This bugs breaks the ability to use the :standard value for *print-json-format*.
-rw-r--r--lib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib.c b/lib.c
index fd3a7514..32b701a7 100644
--- a/lib.c
+++ b/lib.c
@@ -15857,10 +15857,11 @@ val tostringp(val obj)
return get_string_from_stream(ss);
}
-val put_json(val obj, val stream_in, val flat)
+val put_json(val obj, val stream_in, val flat_in)
{
+ val flat = default_null_arg(flat_in);
val stream = default_arg_strict(stream_in, std_output);
- val imode = if3(default_null_arg(flat),
+ val imode = if3(flat,
set_indent_mode(stream, num_fast(indent_foff)),
test_set_indent_mode(stream, num_fast(indent_off),
num_fast(indent_data)));