| 2674 | } |
| 2675 | |
| 2676 | CJSON_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 */ |
| 2717 | CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) |
nothing calls this directly
no test coverage detected
searching dependent graphs…