The text of section h, as one collapsed string. */
| 901 | |
| 902 | /* The text of section h, as one collapsed string. */ |
| 903 | static char *adr_section_text(CBMArena *a, const adr_doc_t *d, int h, size_t cap) { |
| 904 | int start = d->heads[h].line + SKIP_ONE; |
| 905 | int end = h + SKIP_ONE < d->nheads ? d->heads[h + SKIP_ONE].line : d->L.count; |
| 906 | if (start >= end) { |
| 907 | return NULL; |
| 908 | } |
| 909 | const char *s = d->L.v[start].s; |
| 910 | const char *e = d->L.v[end - SKIP_ONE].s + d->L.v[end - SKIP_ONE].n; |
| 911 | return e > s ? adr_plain(a, s, (size_t)(e - s), cap) : NULL; |
| 912 | } |
| 913 | |
| 914 | static int adr_find_section(const adr_doc_t *d, adr_sec_t kind) { |
| 915 | for (int h = 0; h < d->nheads; h++) { |
no test coverage detected