From bfba16a7578d96a54170cbb51e38301713bdc2f7 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 21 Sep 2020 08:34:08 +0000 Subject: [PATCH] restored the lost code for 'J' in fmt.c --- lib/fmt.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/fmt.c b/lib/fmt.c index 7cdaa22..f56c122 100644 --- a/lib/fmt.c +++ b/lib/fmt.c @@ -880,6 +880,17 @@ static int fmt_outv (hcl_fmtout_t* fmtout, va_list ap) break; } + case 'J': + { + hcl_bitmask_t tmp; + if (!fmtout->putobj) goto invalid_format; + tmp = fmtout->mask; + fmtout->mask |= HCL_LOG_PREFER_JSON; + if (fmtout->putobj(fmtout, va_arg(ap, hcl_oop_t)) <= -1) goto oops; + fmtout->mask = tmp; + break; + } + #if 0 case 'e': case 'E': @@ -2467,6 +2478,18 @@ static HCL_INLINE int format_stack_args (hcl_fmtout_t* fmtout, hcl_ooi_t nargs, if (fmtout->putobj(fmtout, arg) <= -1) goto oops; break; + case 'J': + { + hcl_bitmask_t tmp; + GET_NEXT_ARG_TO (hcl, nargs, &arg_state, arg); + tmp = fmtout->mask; + fmtout->mask |= HCL_LOG_PREFER_JSON; + if (fmtout->putobj(fmtout, arg) <= -1) goto oops; + fmtout->mask = tmp; + break; + } + + print_integer: { const hcl_ooch_t* nsptr;