Nice library by the way, but I did find issue that requires correction. I'm using gcc version 11.+ on Ubuntu 22.04. Using your test example from the README.md. (I only added which is generally required to output to stderr. Here's the compile and run error (segmentation fault):
GCC VERSION INFO
ubuntu@ip-172-31-87-157:~/dev/C-Simple-JSON-Parser$ gcc --version
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GCC COMPILATION
ubuntu@ip-172-31-87-157:~/dev/C-Simple-JSON-Parser$ gcc parse_with_error_checking.c json.c -o parse_with_error_checking
parse_with_error_checking.c: In function ‘main’:
parse_with_error_checking.c:20:64: warning: passing argument 1 of ‘json_object_find’ from incompatible pointer type [-Wincompatible-pointer-types]
20
In file included from parse_with_error_checking.c:2:
json.h:156:60: note: expected ‘json_object_t ’ {aka ‘struct json_object_s ’} but argument is of type ‘json_element_t ’ {aka ‘struct json_element_s ’}
156 | result(json_element) json_object_find(typed(json_object) * object, typed(json_string) key);
| ^
Nice library by the way, but I did find issue that requires correction. I'm using gcc version 11.+ on Ubuntu 22.04. Using your test example from the README.md. (I only added which is generally required to output to stderr. Here's the compile and run error (segmentation fault):
GCC VERSION INFO ubuntu@ip-172-31-87-157:~/dev/C-Simple-JSON-Parser$ gcc --version gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~~~In file included from parse_with_error_checking.c:2: json.h:156:60: note: expected ‘json_object_t ’ {aka ‘struct json_object_s ’} but argument is of type ‘json_element_t ’ {aka ‘struct json_element_s ’} 156 | result(json_element) json_object_find(typed(json_object) * object, typed(json_string) key); | ^
EXECUTABLE RUNTIME MESSAGES ubuntu@ip-172-31-87-157:~/dev/C-Simple-JSON-Parser$ ./parse_with_error_checking Segmentation fault (core dumped) ubuntu@ip-172-31-87-157:~/dev/C-Simple-JSON-Parser$