Re: [PATCH] asort: some bug fixes

2023-03-25 Thread Emanuele Torre
On Sun, Mar 26, 2023 at 08:19:25AM +0200, Emanuele Torre wrote: > -sa = xmalloc(n * sizeof(sort_element)); > +if (n) > + sa = xmalloc (n * sizeof(sort_element)); > i = 0; > for ( j = 0; j < hash->nbuckets; ++j ) { > bucket = hash->bucket_array

[PATCH] asort: some bug fixes

2023-03-25 Thread Emanuele Torre
- add some missing free() - avoid calling xmalloc(0) - fix f () { local b; asort -i b a ;} not updating b if b is declared but doesn't have a value using builtin_find_indexed_array() instead of find_or_make_array_variable(): bash-5.2$ typeset a=(z y x) b c=1; asort -i b a; asort -i c a