Re: [PATCH 2/7] object.c: make type_from_string() return "enum object_type"
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Mar 8, 2021, 20:56 UTC
- Message-ID
- <YEaPcFTenqbUGC2C@nand.local>
- In-Reply-To
- <20210308200426.21824-3-avarab@gmail.com>
On Mon, Mar 08, 2021 at 09:04:21PM +0100, Ævar Arnfjörð Bjarmason wrote:
Show 7 quoted lines
> 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