Re: [RFC PATCH v2] list-objects-filter: merge filter data structs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 30, 2019, 16:12 UTC
- Message-ID
- <xmqqef4fyl9l.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190530015658.GA4313@comcast.net>
Matthew DeVore <matvore@google.com> writes:
Show 31 quoted lines
> +struct filter_data {
> + /* Used by all filter types. */
> struct oidset *omits;
> +
> + enum list_objects_filter_result (*filter_object_fn)(
> + struct repository *r,
> + enum list_objects_filter_situation filter_situation,
> + struct object *obj,
> + const char *pathname,
> + const char *filename,
> + struct filter_data *filter_data);
> +
> + void (*filter_clear_fn)(struct filter_data *filter_data);
> +
> + union {
> + struct {
> + /*
> + * Maps trees to the minimum depth at which they were
> + * seen. It is not necessary to re-traverse a tree at
> + * deeper or equal depths than it has already been
> + * traversed.
> + *
> + * We can't use LOFR_MARK_SEEN for tree objects since
> + * this will prevent it from being traversed at
> + * shallower depths.
> + */
> + struct oidmap seen_at_depth;
> +
> + unsigned long exclude_depth;
> + unsigned long current_depth;
> + };Name this, and the ohter two union members, and the union itself as one member inside the outer struct; some compilers would be unhappy with the GCC extension that allows you to refer to the member in this struct as ((struct filter_data *)p)->seen_at_depth, no?
Show 12 quoted lines
> + struct {
> + unsigned long max_bytes;
> + };
> +
> + struct {
> + struct exclude_list el;
> +
> + size_t nr, alloc;
> + struct frame *array_frame;
> + };
> + };
> };