MCPcopy Index your code
hub / github.com/esnet/iperf / cJSON_CreateStringArray

Function cJSON_CreateStringArray

src/cjson.c:2676–2714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2674}
2675
2676CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count)
2677{
2678 size_t i = 0;
2679 cJSON *n = NULL;
2680 cJSON *p = NULL;
2681 cJSON *a = NULL;
2682
2683 if ((count < 0) || (strings == NULL))
2684 {
2685 return NULL;
2686 }
2687
2688 a = cJSON_CreateArray();
2689
2690 for (i = 0; a && (i < (size_t)count); i++)
2691 {
2692 n = cJSON_CreateString(strings[i]);
2693 if(!n)
2694 {
2695 cJSON_Delete(a);
2696 return NULL;
2697 }
2698 if(!i)
2699 {
2700 a->child = n;
2701 }
2702 else
2703 {
2704 suffix_object(p,n);
2705 }
2706 p = n;
2707 }
2708
2709 if (a && a->child) {
2710 a->child->prev = n;
2711 }
2712
2713 return a;
2714}
2715
2716/* Duplication */
2717CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse)

Callers

nothing calls this directly

Calls 4

cJSON_CreateArrayFunction · 0.85
cJSON_CreateStringFunction · 0.85
cJSON_DeleteFunction · 0.85
suffix_objectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…