Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

FR: header-only amalgamation

オープン
#981 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 12 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
c
領域
build-system

調査の方向性

まず cJSON.h と cJSON.c を確認し、次に issue で言及されている Make ベースのリリース方式を調査します。提案されている 3 つの配布オプションと single-header wrapper を比較します。指定された閉じた環境でのユースケースに対して、選択した 1 つの header-only 方式を再現可能にし、その成果物の場所を定義できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

This could be done in three ways:

  1. documentation only "how to create that (may include 2 and/or 3)"
  2. release-only: a real single header file, created automatically (for example via Make) and uploaded to the release, either with a separate name like cjson_amalg.h / cjson_standalone.h or under cJSON.h
  3. a single file stored in this repo - either with a separate name like cjson_amalg.h / cjson_standalone.h or as plain cJSON.h

The following works for a single-header wrapper:

#define CJSON_HIDE_SYMBOLS
#include <cJSON/cJSON.h>
#include <cJSON/cJSON.c>

along with the following

cJSON.h (which could be a separate condition, of course):

 #if defined(CJSON_HIDE_SYMBOLS)
-#define CJSON_PUBLIC(type)   type CJSON_STDCALL
+#define CJSON_PUBLIC(type)   static type CJSON_STDCALL
 #elif defined(CJSON_EXPORT_SYMBOLS)

cJSON.c (which possibly should be declared as static instead of nothing or CJSON_PUBLIC in any case):

 /* Duplication */
-cJSON * cJSON_Duplicate_rec(const cJSON *item, size_t depth, cJSON_bool recurse);
+CJSON_PUBLIC(cJSON *) cJSON_Duplicate_rec(const cJSON *item, size_t depth, cJSON_bool recurse);
 
 CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse)
 {
     return cJSON_Duplicate_rec(item, 0, recurse );
 }
 
-cJSON * cJSON_Duplicate_rec(const cJSON *item, size_t depth, cJSON_bool recurse)
+CJSON_PUBLIC(cJSON *) cJSON_Duplicate_rec(const cJSON *item, size_t depth, cJSON_bool recurse)
 {

Use case: mostly "closed" environments where I can't easily adjust the build system to include cJSON.c (=currently need to do it each time)

主要言語
C
スター
13k
フォーク
3.5k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DaveGamble/cJSON のほかの issue

DaveGamble/cJSON の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。