MCPcopy Index your code
hub / github.com/DaveGamble/cJSON / create_objects

Function create_objects

test.c:109–257  ·  view source on GitHub ↗

Create a bunch of objects as demonstration. */

Source from the content-addressed store, hash-verified

107
108/* Create a bunch of objects as demonstration. */
109static void create_objects(void)
110{
111 /* declare a few. */
112 cJSON *root = NULL;
113 cJSON *fmt = NULL;
114 cJSON *img = NULL;
115 cJSON *thm = NULL;
116 cJSON *fld = NULL;
117 int i = 0;
118
119 /* Our "days of the week" array: */
120 const char *strings[7] =
121 {
122 "Sunday",
123 "Monday",
124 "Tuesday",
125 "Wednesday",
126 "Thursday",
127 "Friday",
128 "Saturday"
129 };
130 /* Our matrix: */
131 int numbers[3][3] =
132 {
133 {0, -1, 0},
134 {1, 0, 0},
135 {0 ,0, 1}
136 };
137 /* Our "gallery" item: */
138 int ids[4] = { 116, 943, 234, 38793 };
139 /* Our array of "records": */
140 struct record fields[2] =
141 {
142 {
143 "zip",
144 37.7668,
145 -1.223959e+2,
146 "",
147 "SAN FRANCISCO",
148 "CA",
149 "94107",
150 "US"
151 },
152 {
153 "zip",
154 37.371991,
155 -1.22026e+2,
156 "",
157 "SUNNYVALE",
158 "CA",
159 "94085",
160 "US"
161 }
162 };
163 volatile double zero = 0.0;
164
165 /* Here we construct some JSON standards, from the JSON site. */
166

Callers 1

test.cFile · 0.85

Calls 12

cJSON_CreateObjectFunction · 0.85
cJSON_AddItemToObjectFunction · 0.85
cJSON_CreateStringFunction · 0.85
cJSON_AddStringToObjectFunction · 0.85
cJSON_AddNumberToObjectFunction · 0.85
cJSON_AddFalseToObjectFunction · 0.85
print_preallocatedFunction · 0.85
cJSON_DeleteFunction · 0.85
cJSON_CreateStringArrayFunction · 0.85
cJSON_CreateArrayFunction · 0.85
cJSON_AddItemToArrayFunction · 0.85
cJSON_CreateIntArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…