is_headerline • returns whether the line is a setext-style hdr underline */
| 1471 | |
| 1472 | /* is_headerline • returns whether the line is a setext-style hdr underline */ |
| 1473 | static int |
| 1474 | is_headerline(uint8_t *data, size_t size) |
| 1475 | { |
| 1476 | size_t i = 0; |
| 1477 | |
| 1478 | /* test of level 1 header */ |
| 1479 | if (data[i] == '=') { |
| 1480 | for (i = 1; i < size && data[i] == '='; i++); |
| 1481 | while (i < size && data[i] == ' ') i++; |
| 1482 | return (i >= size || data[i] == '\n') ? 1 : 0; } |
| 1483 | |
| 1484 | /* test of level 2 header */ |
| 1485 | if (data[i] == '-') { |
| 1486 | for (i = 1; i < size && data[i] == '-'; i++); |
| 1487 | while (i < size && data[i] == ' ') i++; |
| 1488 | return (i >= size || data[i] == '\n') ? 2 : 0; } |
| 1489 | |
| 1490 | return 0; |
| 1491 | } |
| 1492 | |
| 1493 | static int |
| 1494 | is_next_headerline(uint8_t *data, size_t size) |
no outgoing calls
no test coverage detected