| 168 | } |
| 169 | |
| 170 | static void c_push(const c_emit_t *em, const char *ref, size_t n, int syntax, uint32_t line) { |
| 171 | if (n == 0) { |
| 172 | return; |
| 173 | } |
| 174 | if (n > CBM_DOCLINK_C_REF_MAX) { |
| 175 | n = CBM_DOCLINK_C_REF_MAX + SKIP_ONE; /* clipped: the resolver calls it unparseable */ |
| 176 | } |
| 177 | if (c_is_url(ref, n)) { |
| 178 | syntax = CBM_DOCLINK_HREF; |
| 179 | } |
| 180 | char *copy = cbm_arena_strndup(em->ctx->arena, ref, n); |
| 181 | if (!copy) { |
| 182 | return; |
| 183 | } |
| 184 | CBMDocLink link = { |
| 185 | .source_qn = em->def->qualified_name, |
| 186 | .raw = copy, |
| 187 | .line = line, |
| 188 | .def_line = em->def->start_line, |
| 189 | .syntax = (uint16_t)syntax, |
| 190 | }; |
| 191 | cbm_doclinks_push(&em->ctx->result->doc_links, em->ctx->arena, link); |
| 192 | } |
| 193 | |
| 194 | /* Mark the bytes of a line that sit in a code span or a quoted label. */ |
| 195 | static void c_mask(const c_line_t *ln, bool *mask) { |
no test coverage detected