fsck: move typename() printing to its own function
commit97ca7ca8ba3acbc7166fb7ff40819696ed20e8c6
authorJeff King <peff@peff.net>
Thu, 26 Jan 2017 04:11:00 +0000 (25 23:11 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Jan 2017 18:47:20 +0000 (26 10:47 -0800)
tree2fc6954af8e4655cc8f6ebea3c979e0bbf1bef1c
parentc20d4d702f13e6bd4e4c8757989bed62a75e2cfa
fsck: move typename() printing to its own function

When an object has a problem, we mention its type. But we do
so by feeding the result of typename() directly to
fprintf(). This is potentially dangerous because typename()
can return NULL for some type values (like OBJ_NONE).

It's doubtful that this can be triggered in practice with
the current code, so this is probably not fixing a bug. But
it future-proofs us against modifications that make things
like OBJ_NONE more likely (and gives future patches a
central point to handle them).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsck.c