| 620 | } |
| 621 | |
| 622 | static bool gf_active_line(cbm_git_facts_t *facts, const cbm_git_bytes_t *bytes, |
| 623 | const unsigned char **text, size_t *length, |
| 624 | cbm_git_facts_error_t *error) { |
| 625 | if (!facts->batch_budget) |
| 626 | return gf_line(bytes, text, length) || |
| 627 | gf_error(error, CBM_GIT_FACTS_COMMAND, "Malformed Git metadata line"); |
| 628 | if (!bytes->length || bytes->data[bytes->length - 1] != '\n') |
| 629 | return gf_error(error, CBM_GIT_FACTS_COMMAND, "Malformed Git metadata line"); |
| 630 | size_t n = bytes->length - 1; |
| 631 | #ifdef _WIN32 |
| 632 | if (n && bytes->data[n - 1] == '\r') |
| 633 | n--; |
| 634 | #endif |
| 635 | for (size_t at = 0; at < n; at++) { |
| 636 | if ((at & 65535u) == 0 && !gf_gate(facts, error)) |
| 637 | return false; |
| 638 | unsigned char c = bytes->data[at]; |
| 639 | if (!c || c == '\n' || c == '\r') |
| 640 | return gf_error(error, CBM_GIT_FACTS_COMMAND, "Malformed Git metadata line"); |
| 641 | } |
| 642 | *text = bytes->data; |
| 643 | *length = n; |
| 644 | return gf_gate(facts, error); |
| 645 | } |
| 646 | |
| 647 | static bool gf_owned_line(cbm_git_facts_t *facts, const cbm_git_bytes_t *bytes, const char **out, |
| 648 | cbm_git_facts_error_t *error) { |
no test coverage detected