Peter Stephenson wrote on Mon, Nov 30, 2015 at 09:38:32 +0000: > On Mon, 30 Nov 2015 03:21:53 +0000 > Daniel Shahaf wrote: > > I assume that v->pm->gsu.a->getfn() has no access to v->start and > > v->end, hence changing the order is safe. > > Yes, the getfn() is very low level, dealing only with storage for that > parameter and having no knowledge at all of any expansion/substitution > happening above it. > Thanks, that's what I expected. What are the lifetime interfaces of getfn/setfn of arrays? As far as I can tell, getfn returns a "borrowed reference" (i.e., something whose lifetime is managed by the parameter) and setfn "steals" a reference to its second parameter (assumes responsibility for freeing it). I'm asking because I found that $region_highlights' getfn returns a heap-allocated array, while its setfn calls free() on the array passed to it, so . Param pm = $region_highlights; values_a = pm->gsu.a->getfn(); pm->gsu.a->setfn(values_a); . is undefined behaviour (calls free() on a heap pointer, triggering SIGABRT). That's a reduced example of what the "don't reallocate if it's the same size" patch does, and I'm not sure how to make it work: should I change get_re, the setfn, or the callsite which tries to pipe them into each other? (The getfn is get_region_highlight. The setfn is set_region_highlight. I'm attaching that patch in its current state, in case it's relevant; however, it's not ready to be committed, since it triggers the SIGABRT whenever I invoke backward-kill-word.) > > Are there any compilers that choke on 'char **const' (const pointer to pointer > > to char)? > > I suspect we ditched those some years ago when we started making more > use of const, but there might be a few oddballs lying around. > Ack. I'll hold this patch (37253) until the release too then (unless there's another test version first). No point in breaking people's builds if I can avoid it. > > See for example the number of uses of mkarry() > > that should have been "mkarray()". I see 19 uses, then there's > also hmkarray() which comes from the heap and is only used 3 times. *nod*, however, I haven't looked into these yet; I have been looking into the "don't reallocate if it's the same size" part first. Thanks, Daniel