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

From:
Mikhail <mp39590@gmail.com>
Subject:
Re: change got_object_commit_dup() return type
To:
Mark Jamsek <mark@jamsek.com>, Game of Trees <gameoftrees@openbsd.org>
Date:
Mon, 12 Sep 2022 21:18:26 +0300

Download raw body.

Thread
On Mon, Sep 12, 2022 at 09:36:53AM +0200, Stefan Sperling wrote:
> 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.
 
Or maybe add new functions like got_commit_addref/delref.