Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Add :^ syntax for zipping two arrays
On Thu, 31 Jul 2014 19:45:39 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> Any objections to adding this? Comments on the code is also welcome
> since I'm not at all sure I thought of all the gotchas in paramsubst(),
> in particular some allocations might be leaking? Not adding tests until
> any and all comments are incorporated.
That looks pretty reasonable, but I think all the allocations need to be
on the heap at this point (though it's certainly potentially confusing):
so zalloc needs to be zhalloc, ztrdup needs to be dupstring, and mkarray
needs to be... er... however you do mkarray on the heap; I think you
just zhalloc(2), copy the first element, and set the second to
NULL, though I don't see why you couldn't add an hmkarray().
Generally, the command line expansion stuff is all done on the heap ---
it doesn't get turned into permanent allocation until assigned to a
variable, added to a hash, stored as a function definition, or whatever.
Then it looks like it ought basically to work. Some tests would be
useful.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author