die_unterminated_line(), die_invalid_line(): new functions
authorMichael Haggerty <mhagger@alum.mit.edu>
Wed, 13 Sep 2017 17:15:58 +0000 (19:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Sep 2017 06:19:07 +0000 (15:19 +0900)
commit735267aa100e5e75e5b8c74d47f412ad50851ec9
treef15def4c00d7ed783c2307beb3088034e58806a5
parentf0a7dc86d2919a2b91e46503f1df173e58977ef2
die_unterminated_line(), die_invalid_line(): new functions

Extract some helper functions for reporting errors. While we're at it,
prevent them from spewing unlimited output to the terminal. These
functions will soon have more callers.

These functions accept the problematic line as a `(ptr, len)` pair
rather than a NUL-terminated string, and `die_invalid_line()` checks
for an EOL itself, because these calling conventions will be
convenient for future callers. (Efficiency is not a concern here
because these functions are only ever called if the `packed-refs` file
is corrupt.)

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/packed-backend.c