Thread (103 messages) 103 messages, 6 authors, 2021-04-22

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

flat view

From: Taylor Blau <hidden>
Date: 2021-03-08 20:57:56

On Mon, Mar 08, 2021 at 09:04:21PM +0100, Ævar Arnfjörð Bjarmason wrote:
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.
I'm not sure I understand the intention of this and the following few
patches. I could imagine that you eventually want to use other negative
return values for a different purpose, but OBJ_BAD _is_ '-1' (as you
note), and we use 'int' and 'enum object_type' interchangeably in other
parts of the code.

That's not to say that I'm necessarily opposed to picking up these few
patches, but rather that I don't fully understand their purpose.

The patch below looks good.

Thanks,
Taylor
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help