Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jul 29, 2015, 21:34 UTC
- Message-ID
- <vpqmvyed4ws.fsf@anie.imag.fr>
- In-Reply-To
- <CAPig+cS+w8ECma--ncJDoN1fEgrFZMvBC8GBgU6+tLYm_oGkaw@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 12 quoted lines
>> @@ -1254,9 +1273,26 @@ static void emit(const char *cp, const char *ep)
>> +static void reset_formatting_state(struct ref_formatting_state *state)
>> +{
>> + int quote_style = state->quote_style;
>> + memset(state, 0, sizeof(*state));
>> + state->quote_style = quote_style;
>
> I wonder if this sledge-hammer approach of saving one or two values
> before clearing the entire 'ref_formatting_state' and then restoring
> the saved values will scale well. Would it be better for this to just
> individually reset the fields which need resetting and not touch those
> that don't?I'm the one who suggested these 3 lines. I wrote them this way with the assumption that there would only be 1 field to keep, and thet the rest of the series was going to add more fields to reset (currently true I think), to avoid the risk of forgetting one value to reset.
I'm fine with the other way around too.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/