Deduplicate cJSON: consolidate 4 copies into a single canonical pair

- Compile cJSON.c as a standalone C translation unit (added stdbool.h)
- Rename hush_cJSON.c → hush_cJSON.cpp and compile as standalone C++ unit
  with forward declarations for external deps (_stripwhite, clonestr, etc.)
- Remove #include "cJSON.c" unity-build from hush_cJSON
- Change hush.h from #include "hush_cJSON.c" to #include "hush_cJSON.h"
- Add both files to libbitcoin_server_a_SOURCES in Makefile.am
- Delete cc/dapps/cJSON.c (old 2009 fork, 1201 lines removed)
- Replace cc/includes/cJSON.h with thin redirect to canonical headers
- Update dapp includes to reference canonical cJSON.c
This commit is contained in:
dan_s
2026-02-27 09:39:48 -06:00
parent f565b2920d
commit ab6a3a05d7
10 changed files with 32 additions and 1455 deletions

View File

@@ -83,14 +83,14 @@ There are **13,652 lines** of implementation code in `hush_*.h` headers:
## 6. Deduplicate Vendored Code
`cJSON` exists in **4 copies**:
`cJSON` has been consolidated:
- `src/cJSON.c` + `src/cJSON.h`
- `src/hush_cJSON.c` + `src/hush_cJSON.h`
- `src/cc/dapps/cJSON.c`
- `src/cc/includes/cJSON.h`
- `src/cJSON.c` + `src/cJSON.h` — canonical implementation, compiled as a standalone C translation unit
- `src/hush_cJSON.cpp` + `src/hush_cJSON.h` — helper/wrapper functions, compiled as a standalone C++ translation unit
- `src/cc/includes/cJSON.h` — thin redirect to the canonical headers above
- `src/cc/dapps/cJSON.c` — deleted (old 2009 fork); dapp includes updated to use canonical copy
- [ ] Consolidate to a single copy and have other modules link against it
- [x] Consolidate to a single copy and have other modules link against it
## 7. Relocate Shell Scripts Out of `src/`