MCPcopy Index your code
hub / github.com/DaveGamble/cJSON / cJSON_CreateDoubleArray

Function cJSON_CreateDoubleArray

cJSON.c:2686–2724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2684}
2685
2686CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count)
2687{
2688 size_t i = 0;
2689 cJSON *n = NULL;
2690 cJSON *p = NULL;
2691 cJSON *a = NULL;
2692
2693 if ((count < 0) || (numbers == NULL))
2694 {
2695 return NULL;
2696 }
2697
2698 a = cJSON_CreateArray();
2699
2700 for(i = 0; a && (i < (size_t)count); i++)
2701 {
2702 n = cJSON_CreateNumber(numbers[i]);
2703 if(!n)
2704 {
2705 cJSON_Delete(a);
2706 return NULL;
2707 }
2708 if(!i)
2709 {
2710 a->child = n;
2711 }
2712 else
2713 {
2714 suffix_object(p, n);
2715 }
2716 p = n;
2717 }
2718
2719 if (a && a->child) {
2720 a->child->prev = n;
2721 }
2722
2723 return a;
2724}
2725
2726CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count)
2727{

Calls 4

cJSON_CreateArrayFunction · 0.85
cJSON_CreateNumberFunction · 0.85
cJSON_DeleteFunction · 0.85
suffix_objectFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…