Re: [PATCH 04/15] ref-filter: add ref_filter_clear()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Taylor Blau <me@xxxxxxxxxxxx> writes:

> From: Jeff King <peff@xxxxxxxx>
>
> We did not bother to clean up at all in branch/tag, and for-each-ref
> only hit a few elements. So this is probably cleaning up leaks, but I
> didn't check yet.
>
> Note that the reachable_from and unreachable_from lists should be
> cleaned as they are used. So this is just covering any case where we
> might bail before running the reachability check.
> ---

Not signed-off?

> +void ref_filter_clear(struct ref_filter *filter)
> +{
> +	oid_array_clear(&filter->points_at);
> +	free_commit_list(filter->with_commit);
> +	free_commit_list(filter->no_commit);
> +	free_commit_list(filter->reachable_from);
> +	free_commit_list(filter->unreachable_from);
> +	ref_filter_init(filter);
> +}

And the previous step matters here---otherwise we will end up
walking two commit lists whose elements have all been popped
in reach_filter().

Makes sense.

> +void ref_filter_init(struct ref_filter *filter)
> +{
> +	struct ref_filter blank = REF_FILTER_INIT;
> +	memcpy(filter, &blank, sizeof(blank));
> +}


I wonder if structure assignment "*filter = blank" is easier to see
but I think we've seen this "_INIT; memcpy()" dance before.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux