MCPcopy Create free account
hub / github.com/SVF-tools/SVF / cJSON_ArrayForEach

Function cJSON_ArrayForEach

svf/lib/Util/cJSON.cpp:3095–3108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3093 cJSON *a_element = NULL;
3094 cJSON *b_element = NULL;
3095 cJSON_ArrayForEach(a_element, a)
3096 {
3097 /* TODO This has O(n^2) runtime, which is horrible! */
3098 b_element = get_object_item(b, a_element->string, case_sensitive);
3099 if (b_element == NULL)
3100 {
3101 return false;
3102 }
3103
3104 if (!cJSON_Compare(a_element, b_element, case_sensitive))
3105 {
3106 return false;
3107 }
3108 }
3109
3110 /* doing this twice, once on a and b to prevent true comparison if a subset of b
3111 * TODO: Do this the proper way, this is just a fix for now */

Callers

nothing calls this directly

Calls 2

get_object_itemFunction · 0.85
cJSON_CompareFunction · 0.85

Tested by

no test coverage detected