| 990 | } |
| 991 | |
| 992 | const char *md_json_writep(const md_json_t *json, apr_pool_t *p, md_json_fmt_t fmt) |
| 993 | { |
| 994 | apr_array_header_t *chunks; |
| 995 | int rv; |
| 996 | |
| 997 | chunks = apr_array_make(p, 10, sizeof(char *)); |
| 998 | rv = json_dump_callback(json->j, chunk_cb, chunks, fmt_to_flags(fmt)); |
| 999 | if (APR_SUCCESS != rv) { |
| 1000 | md_log_perror(MD_LOG_MARK, MD_LOG_ERR, 0, p, |
| 1001 | "md_json_writep failed to dump JSON"); |
| 1002 | return NULL; |
| 1003 | } |
| 1004 | |
| 1005 | switch (chunks->nelts) { |
| 1006 | case 0: |
| 1007 | return ""; |
| 1008 | case 1: |
| 1009 | return APR_ARRAY_IDX(chunks, 0, const char*); |
| 1010 | default: |
| 1011 | return apr_array_pstrcat(p, chunks, 0); |
| 1012 | } |
| 1013 | } |
| 1014 | |
| 1015 | apr_status_t md_json_writef(const md_json_t *json, apr_pool_t *p, md_json_fmt_t fmt, apr_file_t *f) |
| 1016 | { |
no test coverage detected