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

Function cJSON_CreateDoubleArray

src/cjson.c:2636–2674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2634}
2635
2636CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count)
2637{
2638 size_t i = 0;
2639 cJSON *n = NULL;
2640 cJSON *p = NULL;
2641 cJSON *a = NULL;
2642
2643 if ((count < 0) || (numbers == NULL))
2644 {
2645 return NULL;
2646 }
2647
2648 a = cJSON_CreateArray();
2649
2650 for(i = 0; a && (i < (size_t)count); i++)
2651 {
2652 n = cJSON_CreateNumber(numbers[i]);
2653 if(!n)
2654 {
2655 cJSON_Delete(a);
2656 return NULL;
2657 }
2658 if(!i)
2659 {
2660 a->child = n;
2661 }
2662 else
2663 {
2664 suffix_object(p, n);
2665 }
2666 p = n;
2667 }
2668
2669 if (a && a->child) {
2670 a->child->prev = n;
2671 }
2672
2673 return a;
2674}
2675
2676CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count)
2677{

Callers

nothing calls this directly

Calls 4

cJSON_CreateArrayFunction · 0.85
cJSON_CreateNumberFunction · 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…