"brian m. carlson" <sandals@xxxxxxxxxxxxxxxxxxxx> writes: > From: "brian m. carlson" <bk2204@xxxxxxxxxx> > > Right now, all of our values are constants whose allocation is managed > elsewhere. However, in the future, we'll have some variables whose > memory we will need to free. To keep things consistent, let's make each > of our functions allocate its own memory and make the caller responsible > for freeing it. > > Signed-off-by: brian m. carlson <bk2204@xxxxxxxxxx> > --- > builtin/var.c | 45 +++++++++++++++++++++++++++++---------------- > 1 file changed, 29 insertions(+), 16 deletions(-) Making everybody allocate like this patch does is also fine, but FWIW, with [3/7], we can selectively set ".need_free = 1" for minority of elements in the array that returns an allocated piece of memory without making the source code too noisy (as the array elements for existing majority can omit ".need_free = 0" and leave it to the default initialization), so I am not opposed to the "we set .need_free bit only for those that we allocate" approach taken with the previous round. Thanks.