| 909 | } |
| 910 | |
| 911 | apr_status_t md_json_setsa(apr_array_header_t *a, md_json_t *json, ...) |
| 912 | { |
| 913 | json_t *nj, *j; |
| 914 | va_list ap; |
| 915 | int i; |
| 916 | |
| 917 | va_start(ap, json); |
| 918 | j = jselect(json, ap); |
| 919 | va_end(ap); |
| 920 | |
| 921 | if (!j || !json_is_array(j)) { |
| 922 | const char *key; |
| 923 | |
| 924 | va_start(ap, json); |
| 925 | j = jselect_parent(&key, 1, json, ap); |
| 926 | va_end(ap); |
| 927 | |
| 928 | if (!key || !j || !json_is_object(j)) { |
| 929 | return APR_EINVAL; |
| 930 | } |
| 931 | nj = json_array(); |
| 932 | json_object_set_new(j, key, nj); |
| 933 | j = nj; |
| 934 | } |
| 935 | |
| 936 | json_array_clear(j); |
| 937 | for (i = 0; i < a->nelts; ++i) { |
| 938 | json_array_append_new(j, json_string(APR_ARRAY_IDX(a, i, const char*))); |
| 939 | } |
| 940 | return APR_SUCCESS; |
| 941 | } |
| 942 | |
| 943 | /**************************************************************************************************/ |
| 944 | /* formatting, parsing */ |
no test coverage detected