The value of header field `key` between the title and the first body * heading (the first lines when there is no heading). */
| 923 | /* The value of header field `key` between the title and the first body |
| 924 | * heading (the first lines when there is no heading). */ |
| 925 | static char *adr_header_field(CBMArena *a, const adr_doc_t *d, const char *key) { |
| 926 | int from = d->title_head >= 0 ? d->heads[d->title_head].line + SKIP_ONE : d->L.fm_end; |
| 927 | int to = d->L.count; |
| 928 | for (int h = 0; h < d->nheads; h++) { |
| 929 | if (h != d->title_head && d->heads[h].line >= from) { |
| 930 | to = d->heads[h].line; |
| 931 | break; |
| 932 | } |
| 933 | } |
| 934 | if (to == d->L.count && to - from > ADR_HEAD_SCAN) { |
| 935 | to = from + ADR_HEAD_SCAN; |
| 936 | } |
| 937 | for (int k = from; k < to; k++) { |
| 938 | if (!d->L.v[k].text) { |
| 939 | continue; |
| 940 | } |
| 941 | char *v = adr_field(a, &d->L.v[k], key); |
| 942 | if (v) { |
| 943 | return v; |
| 944 | } |
| 945 | } |
| 946 | return NULL; |
| 947 | } |
| 948 | |
| 949 | /* ── Relations ───────────────────────────────────────────────────── */ |
| 950 |
no test coverage detected