DaveGamble / cJSON

Ultralightweight JSON parser in ANSI C
MIT License
10.68k stars 3.21k forks source link

Enable compatibility with Linux (and other) kernel #836

Open greenduck opened 7 months ago

greenduck commented 7 months ago

The purpose of this PR is to enable using cJSON in the kernel space, in particular Linux kernel.
This requirement has 3 consequences:

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.

Alanscut commented 5 months ago

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.