MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / cJSON_CreateDoubleArray

Function cJSON_CreateDoubleArray

external/cJSON/cJSON.c:2701–2739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2699}
2700
2701CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count)
2702{
2703 size_t i = 0;
2704 cJSON *n = NULL;
2705 cJSON *p = NULL;
2706 cJSON *a = NULL;
2707
2708 if ((count < 0) || (numbers == NULL))
2709 {
2710 return NULL;
2711 }
2712
2713 a = cJSON_CreateArray();
2714
2715 for(i = 0; a && (i < (size_t)count); i++)
2716 {
2717 n = cJSON_CreateNumber(numbers[i]);
2718 if(!n)
2719 {
2720 cJSON_Delete(a);
2721 return NULL;
2722 }
2723 if(!i)
2724 {
2725 a->child = n;
2726 }
2727 else
2728 {
2729 suffix_object(p, n);
2730 }
2731 p = n;
2732 }
2733
2734 if (a && a->child) {
2735 a->child->prev = n;
2736 }
2737
2738 return a;
2739}
2740
2741CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count)
2742{

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