MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / json_free

Function json_free

tinyemu/json.c:252–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252void json_free(JSONValue val)
253{
254 switch(val.type) {
255 case JSON_STR:
256 case JSON_EXCEPTION:
257 free(val.u.str);
258 break;
259 case JSON_INT:
260 case JSON_BOOL:
261 case JSON_NULL:
262 case JSON_UNDEFINED:
263 break;
264 case JSON_ARRAY:
265 {
266 JSONArray *array = val.u.array;
267 int i;
268
269 for(i = 0; i < array->len; i++) {
270 json_free(array->tab[i]);
271 }
272 free(array);
273 }
274 break;
275 case JSON_OBJ:
276 {
277 JSONObject *obj = val.u.obj;
278 JSONProperty *f;
279 int i;
280
281 for(i = 0; i < obj->len; i++) {
282 f = &obj->props[i];
283 json_free(f->name);
284 json_free(f->value);
285 }
286 free(obj);
287 }
288 break;
289 default:
290 abort();
291 }
292}
293
294static void skip_spaces(const char **pp)
295{

Callers 6

fs_dump_cache_loadFunction · 0.85
json_object_setFunction · 0.85
json_array_setFunction · 0.85
json_parse_valueFunction · 0.85
bf_init_onloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected