cJSON

mirror of Dave's cJSON
git clone git://git.thc420.xyz/cJSON
Log | Files | Refs | README | LICENSE

commit 123bb1af7bfae41d805337fef4b41045ef6c7d25
parent cf862d0fed7f9407e4b046d78d3d8050d2080d12
Author: Max Bruckner <max@maxbruckner.de>
Date:   Wed, 15 Feb 2017 23:21:50 +0100

cJSON: prevent incompatible C and header versions

Introduces a preprocessor directive that aborts the compilation if the
version numbers in the header don't match with the numbers in the c
file.

Diffstat:
McJSON.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/cJSON.c b/cJSON.c @@ -58,6 +58,11 @@ const char *cJSON_GetErrorPtr(void) return (const char*) global_ep; } +/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ +#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 2) || (CJSON_VERSION_PATCH != 1) + #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. +#endif + extern const char* cJSON_Version(void) { static char version[15];