"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: change got_object_commit_dup() return type
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Mon, 12 Sep 2022 09:36:53 +0200

Download raw body.

Thread
On Mon, Sep 12, 2022 at 03:43:40PM +1000, Mark Jamsek wrote:
> This can be void. We could arguably drop the function and do this
> inline, but using the function is more consistent with Got style imo.
> 
> ok?

Yes, your patch improves the code as it is.

However, the general idea of this _dup() function does not seem good.
Callers might assume they can free the original pointer after _dup(),
because, by convention, _dup() implies a new allocation.
I don't think it is wise to deviate from this convention.

Instead of having such a weird _dup() function, we could simply increment
the reference counter directly where needed.