Thread (97 messages) 97 messages, 9 authors, 2025-08-03

Re: [PATCH v4 01/14] config: clarify memory ownership when preparing comment strings

From: Kristoffer Haugsbakk <hidden>
Date: 2024-05-03 10:13:44

On Fri, May 3, 2024, at 11:56, Patrick Steinhardt wrote:
The ownership of memory returned when preparing a comment string is
quite intricate: when the returned value is different than the passed
value, then the caller is responsible to free the memory. This is quite
subtle, and it's even easier to miss because the returned value is in
fact a `const char *`.

Adapt the function to always return either `NULL` or a newly allocated
string. The function is called at most once per git-config(1), so it's
not like this micro-optimization really matters. Thus, callers are now
always responsible for freeing the value.
---
Missing a signoff on this one. The only one in the series.

-- 
Kristoffer Haugsbakk
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help