cJSON icon indicating copy to clipboard operation
cJSON copied to clipboard

Enable compatibility with Linux (and other) kernel

Open greenduck opened this issue 1 year ago • 1 comments

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.

greenduck avatar Mar 03 '24 08:03 greenduck

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.

Alanscut avatar Apr 30 '24 01:04 Alanscut