| 188 | } |
| 189 | |
| 190 | static apr_status_t jselect_insert(json_t *val, size_t index, md_json_t *json, va_list ap) |
| 191 | { |
| 192 | const char *key; |
| 193 | json_t *j, *aj; |
| 194 | |
| 195 | j = jselect_parent(&key, 1, json, ap); |
| 196 | |
| 197 | if (!j || !json_is_object(j)) { |
| 198 | json_decref(val); |
| 199 | return APR_EINVAL; |
| 200 | } |
| 201 | |
| 202 | aj = json_object_get(j, key); |
| 203 | if (!aj) { |
| 204 | aj = json_array(); |
| 205 | json_object_set_new(j, key, aj); |
| 206 | } |
| 207 | |
| 208 | if (!json_is_array(aj)) { |
| 209 | json_decref(val); |
| 210 | return APR_EINVAL; |
| 211 | } |
| 212 | |
| 213 | if (json_array_size(aj) <= index) { |
| 214 | json_array_append(aj, val); |
| 215 | } |
| 216 | else { |
| 217 | json_array_insert(aj, index, val); |
| 218 | } |
| 219 | return APR_SUCCESS; |
| 220 | } |
| 221 | |
| 222 | static apr_status_t jselect_set(json_t *val, md_json_t *json, va_list ap) |
| 223 | { |
no test coverage detected