Re: [RFC PATCH 3/6] contrib/cgit-rs: introduce Rust wrapper for libgit.a
- From
Josh Steadmon <steadmon@google.com>
- Date
- Aug 8, 2024, 17:15 UTC
- Message-ID
- <em2spwpn4c3uzi2v2bnwn5y34vnmjkkajlmhkqmyjf547q7xgy@m2d4y2z4yypl>
- In-Reply-To
- <xmqqo763lppr.fsf@gitster.g>
On 2024.08.07 19:21, Junio C Hamano wrote:
Show 15 quoted lines
> "brian m. carlson" <sandals@crustytoothpaste.net> writes: > > > I think if we're going to be writing a general purpose API for > > libification, we probably should provide free functions. Normally, that > > will be a call to free(3), but in some cases we may need more complex > > logic, and by providing those, we're making the API more consistent and > > easy to use. > > Do you mean that we should have variants of free() that are specific > to each data structure? E.g., Patrick taught fetch_task_release() > to release the task structure itself, in addition to the resources > it holds, while renaming fetch_task_release() to fetch_task_free(), > with ff25992c (submodule: fix leaking fetch tasks, 2024-08-07), so > if cgit-sys wants to expose fetch_task object to the outside world, > the consumers would call fetch_task_free() on it?
Yes, although hopefully the higher-level API we build on top of cgit-sys will be able to hide this from the Rust consumers.