Closed pavelxdd closed 1 year ago
Merging #97 (2ccd693) into master (b2a6dfe) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #97 +/- ##
=======================================
Coverage 98.41% 98.42%
=======================================
Files 2 2
Lines 2335 2347 +12
=======================================
+ Hits 2298 2310 +12
Misses 37 37
Impacted Files | Coverage Δ | |
---|---|---|
src/yyjson.h | 87.05% <ø> (ø) |
|
src/yyjson.c | 98.85% <100.00%> (+<0.01%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
I've updated the commit with following changes:
1) Removed unsafe_yyjson_read_number
in favor of yyjson_read_number
.
yyjson_mut_read_number
is just a wrapper around yyjson_read_number
.
2) Return end
pointer instead of boolean if parsing was successful, or return NULL instead.
3) Support yyjson_read_err
optional parameter.
https://github.com/ibireme/yyjson/blob/b2a6dfeb9c89cc53adc6203896a66850a5973373/src/yyjson.c#L3508
The current error message is misleading if no zero sign is present in buffer. For example .123
gives this message, and sets the cur
to hdr - 1
, so we can't safely cur - hdr
after this error.
Hence, I've added a _pos > hdr
check in return_err
macro.
I've added test cases based on test_number
text files.
Also added support for YYJSON_READ_NUMBER_AS_RAW
and YYJSON_READ_ALLOW_INF_AND_NAN
read flags.
Thanks, it looks much better now~
I really like the yyjson
read_number
implementation and want to use it in my projects. The problem is that the current implementation is a static function which can't be used from other code.I've added a simple wrapper
unsafe_yyjson_read_number
aroundread_number
function, which parses number from the memory buffer intoyyjson_val
(oryyjson_mut_val
) variable.