On (27/06/14 11:10), Sumit Bose wrote:
On Fri, Jun 27, 2014 at 10:52:42AM +0200, Lukas Slebodnik wrote:
> On (27/06/14 10:41), Jakub Hrozek wrote:
> >On Thu, Jun 26, 2014 at 07:37:33PM +0200, Pavel Reichl wrote:
> >> Hello,
> >> please see attached patch.
> >> Thanks,
> >> PR
> >Would it be more readable if the condition said "num_missing > 0" ?
> or do not call talloc_realloc if num_missing == 0
> talloc_realloc is used here for shrinking array allocated before for cycle
> with talloc_zero_array.
If the last argument is 0 talloc_realloc() is effectively a
talloc_free() which makes sense in this case.
Thank you for interesting info. I didn't know that.
I should read talloc documentation more carefully.
* talloc_realloc() has the following equivalences:
* talloc_realloc(ctx, NULL, type, 1) ==> talloc(ctx, type);
* talloc_realloc(ctx, NULL, type, N) ==> talloc_array(ctx, type, N);
* talloc_realloc(ctx, ptr, type, 0) ==> talloc_free(ptr);