From 699edbfbf1249503a743f1b145faddf37b5a2bcd Mon Sep 17 00:00:00 2001 From: ibireme Date: Sun, 30 Jun 2024 16:19:58 +0800 Subject: [PATCH] Support different compile-time options: #170 --- src/yyjson.c | 2 +- test/test_number.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/yyjson.c b/src/yyjson.c index 3ba5173..16ecbac 100644 --- a/src/yyjson.c +++ b/src/yyjson.c @@ -5072,7 +5072,7 @@ static_inline bool read_number(u8 **ptr, bool sign; /* read number as raw string if has `YYJSON_READ_NUMBER_AS_RAW` flag */ - if (unlikely(pre && !has_read_flag(BIGNUM_AS_RAW))) { + if (has_read_flag(NUMBER_AS_RAW)) { return read_number_raw(ptr, pre, flg, val, msg); } diff --git a/test/test_number.c b/test/test_number.c index 48a1df5..8a67fd7 100644 --- a/test/test_number.c +++ b/test/test_number.c @@ -862,7 +862,9 @@ static void test_bignum(void) { yyjson_read_flag flag_arr[] = { YYJSON_READ_NUMBER_AS_RAW, YYJSON_READ_BIGNUM_AS_RAW, +#if !YYJSON_DISABLE_NON_STANDARD YYJSON_READ_ALLOW_INF_AND_NAN, +#endif }; for (usize i = 0; i < yy_nelems(num_arr); i++) {