cJSON
cJSON copied to clipboard
Enable compatibility with Linux (and other) kernel
The purpose of this PR is to enable using cJSON in the kernel space, in particular Linux kernel.
This requirement has 3 consequences:
- no floating point numbers
- Linux-specific header files
- refrain from using insecure functions (sprintf())
When building as a part of Linux kernel code, the KERNEL macro will be recognized automatically.
In order to build with no floating point numbers, introduce NO_FLOATING_POINT macro. This macro is automatically introduced in case KERNEL is present.
This PR strives to keep all the existing functionality unchanged.
As it's declared in README:
cJSON is written in ANSI C (C89) in order to support as many platforms and compilers as possible.
cJSON is designed to use ANSI C/c89. Many users are relying on this. We do not want to break this.