Thread (1 message) 1 message, 1 author, 2021-03-08

Re: [PATCH 2/7] object.c: make type_from_string() return "enum object_type"

From: Junio C Hamano <hidden>
Date: 2021-03-08 21:49:19

Ævar Arnfjörð Bjarmason  [off-list ref] writes:
Change the type_from_string*() functions to return an "enum
object_type", and refactor their callers to check for "== OBJ_BAD"
instead of "< 0".

This helps to distinguish code in object.c where we really do return
-1 from code that returns an "enum object_type", whose OBJ_BAD happens
to be -1.
"We will be adding different error modes and the plan is to signal
them by returning negative values other than -1" would make sense
(if that is what we are going to see in the remainder of the
series), but not the above.

To the callees, what comes back from a function is -1 either way,
and they cannot tell -1 resulting from OBJ_BAD and -1 resulting from
error() apart, can they?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help