Re: [PATCH v13 10/14] apply: change error_routine when silent
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- Sep 4, 2016, 16:31 UTC
- Message-ID
- <e39d9b83-949b-075c-07f6-60118dc24961@ramsayjones.plus.com>
- In-Reply-To
- <CAP8UFD38CC-Ah9zVcnU3a4nGH2CzOn74Adx=42pmckjPv=e_Bg@mail.gmail.com>
On 04/09/16 11:54, Christian Couder wrote:
Show 46 quoted lines
> On Thu, Sep 1, 2016 at 10:19 AM, Christian Couder > <christian.couder@gmail.com> wrote: >> On Thu, Sep 1, 2016 at 12:20 AM, Stefan Beller <sbeller@google.com> wrote: >>> On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder >>> <christian.couder@gmail.com> wrote: >>>> To avoid printing anything when applying with >>>> `state->apply_verbosity == verbosity_silent`, let's save the >>>> existing warn and error routines before applying, and let's >>>> replace them with a routine that does nothing. >>>> >>>> Then after applying, let's restore the saved routines. >>>> >>>> Helped-by: Stefan Beller <sbeller@google.com> >>>> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> >>>> --- >>>> apply.c | 21 ++++++++++++++++++++- >>>> apply.h | 8 ++++++++ >>>> 2 files changed, 28 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/apply.c b/apply.c >>>> index ddbb0a2..bf81b70 100644 >>>> --- a/apply.c >>>> +++ b/apply.c >>>> @@ -112,6 +112,11 @@ void clear_apply_state(struct apply_state *state) >>>> /* &state->fn_table is cleared at the end of apply_patch() */ >>>> } >>>> >>>> +static void mute_routine(const char *bla, va_list params) >>> >>> Instead of 'bla' you could go with 'format' as the man page for >>> [f]printf puts it. >>> Or you could leave it empty, i.e. >>> >>> static void mute_routine(const char *, va_list) >>> ... >> >> Ok to do that. > > Actually I get the following error when doing that: > > apply.c: In function ‘mute_routine’: > apply.c:115:1: error: parameter name omitted > static void mute_routine(const char *, va_list) > ^ > apply.c:115:1: error: parameter name omitted > make: *** [apply.o] Error 1
Yes, this is not C++. ;-)
> So I will leave it as is.
I think I would prefer to see:
static void mute_routine(const char *msg, va_list params)
given that it would either be an error-msg or a warning-msg.
ATB, Ramsay Jones