Menu

#9 Include stddef.h in cJSON.h for type "size_t"

Unstable (example)
open
nobody
None
5
2015-12-31
2015-12-31
No

In cJSON.h, type "size_t" is used in the malloc_fn field of the cJSON_Hooks struct, but the header file defining it, stddef.h, is not included. This could cause the compiling error of "unknown type name 'size_t'" if the source using it does not get the definition "just in time" from any header files it had included before the inclusion of the cJSON.h header. This kind of situation is not common, but it does happen.

The attached patch adds the inclusion of the header "stddef.h" in the beginning of the cJSON.h to make sure size_t is defined.

1 Attachments

Discussion


Log in to post a comment.