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

Function cJSON_CreateFloatArray

src/cjson.c:2596–2634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2594}
2595
2596CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count)
2597{
2598 size_t i = 0;
2599 cJSON *n = NULL;
2600 cJSON *p = NULL;
2601 cJSON *a = NULL;
2602
2603 if ((count < 0) || (numbers == NULL))
2604 {
2605 return NULL;
2606 }
2607
2608 a = cJSON_CreateArray();
2609
2610 for(i = 0; a && (i < (size_t)count); i++)
2611 {
2612 n = cJSON_CreateNumber((double)numbers[i]);
2613 if(!n)
2614 {
2615 cJSON_Delete(a);
2616 return NULL;
2617 }
2618 if(!i)
2619 {
2620 a->child = n;
2621 }
2622 else
2623 {
2624 suffix_object(p, n);
2625 }
2626 p = n;
2627 }
2628
2629 if (a && a->child) {
2630 a->child->prev = n;
2631 }
2632
2633 return a;
2634}
2635
2636CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count)
2637{

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…