Re: [PATCH v2 2/4] diff: convert flags to be stored in bitfields
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 31, 2017, 04:41 UTC
- Message-ID
- <xmqq8tfs2al4.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20171030194646.27473-3-bmwill@google.com>
Brandon Williams <bmwill@google.com> writes:
> + if (flags) > + rev.diffopt.flags = diff_flags_or(&rev.diffopt.flags, flags);
If we are avoiding from passing a struct (even if it is a small one) by value, then returning a struct as value defeats the point of the exercise, I would think. If that will be the calling cconvention, making diff_flags_or(&a, &b) to update &a by or'ing bits in &b would be more natural.
Having said that, as I said in a separate message, as long as we have this _or() thing, no sane person would add anything but bitfields to the structure which will guarantee that it will stay to be small set of flags and nothing else---so I personally am fine with pass by value (which in turn makes it OK to return as a value, too).
Other than that, this step looked reasonable to me.
Thanks.