ibireme / yyjson

The fastest JSON library in C
https://ibireme.github.io/yyjson/doc/doxygen/html/
MIT License
3.12k stars 267 forks source link

Check that the type of value is array before modifying it #44

Closed pavelxdd closed 3 years ago

pavelxdd commented 3 years ago

Unless there's a specific reason not to do it, I think that the type of yyjson_mut_val should be checked, that it is an array, before modifying in yyjson_mut_arr functions.

For yyjson_mut_obj the type is always checked.

For yyjson_val array the type is also already checked.

codecov[bot] commented 3 years ago

Codecov Report

Merging #44 (91afb1d) into master (37b5652) will decrease coverage by 0.00%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
- Coverage   98.55%   98.55%   -0.01%     
==========================================
  Files           2        2              
  Lines        1870     1869       -1     
==========================================
- Hits         1843     1842       -1     
  Misses         27       27              
Impacted Files Coverage Δ
src/yyjson.h 92.85% <ø> (-0.09%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 37b5652...91afb1d. Read the comment docs.

ibireme commented 3 years ago

Yes, the type should be checked, maybe I should add more test code.