From: Matthieu Moy Date: Wed, 29 Jul 2015 21:34:27 GMT Subject: Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state' Message-ID: In-Reply-To: Eric Sunshine writes: >> @@ -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/