Skip to content

[BUG][C] The bundled cJSON is an old version, and it should be a library dependency anyway #20431

@imaami

Description

@imaami

Currently cJSON is just a copy of the v1.7.7 sources (with a few typo fixes in comments). It's old (2018) and not used like a library dependency really should. It should be dynamically linked like is already done with OpenSSL and libcurl.

Word diff of upstream cJSON v1.7.7 and openapi-generator's bundled copy:

Screenshot_20250109-210912~3

Here's the script from the screenshot:

#!/usr/bin/env bash

domain='https://raw.githubusercontent.com'
a="$domain/DaveGamble/cJSON/refs/tags/v1.7.7"
b="$domain/OpenAPITools/openapi-generator/refs/heads/master"
b+='/modules/openapi-generator/src/main/resources/C-libcurl'

for f in cJSON.{c,h}; do
  printf -vx "%0${#f}d"
  x="+-${x//0/-}-+"
  printf "\n$x\n| %s |\n$x\n" "$f"
  git diff -U0 --no-index --color=always --color-words \
      <(curl "$a/$f" -s) <(curl "$b/$f.mustache" -s) \
  | tail -n+4
done

echo

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions