[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/9] monitor: make error_vprintf_unless_qmp() static
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 1/9] monitor: make error_vprintf_unless_qmp() static |
Date: |
Thu, 07 Jul 2022 14:23:10 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
marcandre.lureau@redhat.com writes:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Not needed outside monitor.c. Remove the needless stub.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> include/monitor/monitor.h | 1 -
> monitor/monitor.c | 3 ++-
> stubs/error-printf.c | 5 -----
> 3 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
> index a4b40e8391db..44653e195b45 100644
> --- a/include/monitor/monitor.h
> +++ b/include/monitor/monitor.h
> @@ -56,7 +56,6 @@ void monitor_register_hmp(const char *name, bool info,
> void monitor_register_hmp_info_hrt(const char *name,
> HumanReadableText *(*handler)(Error
> **errp));
>
> -int error_vprintf_unless_qmp(const char *fmt, va_list ap) G_GNUC_PRINTF(1,
> 0);
> int error_printf_unless_qmp(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
>
> #endif /* MONITOR_H */
> diff --git a/monitor/monitor.c b/monitor/monitor.c
> index 86949024f643..ba4c1716a48a 100644
> --- a/monitor/monitor.c
> +++ b/monitor/monitor.c
> @@ -273,7 +273,8 @@ int error_vprintf(const char *fmt, va_list ap)
> return vfprintf(stderr, fmt, ap);
> }
>
> -int error_vprintf_unless_qmp(const char *fmt, va_list ap)
> +G_GNUC_PRINTF(1, 0)
> +static int error_vprintf_unless_qmp(const char *fmt, va_list ap)
> {
> Monitor *cur_mon = monitor_cur();
>
> diff --git a/stubs/error-printf.c b/stubs/error-printf.c
> index 0e326d801059..1afa0f62ca26 100644
> --- a/stubs/error-printf.c
> +++ b/stubs/error-printf.c
> @@ -16,8 +16,3 @@ int error_vprintf(const char *fmt, va_list ap)
> }
> return vfprintf(stderr, fmt, ap);
> }
> -
> -int error_vprintf_unless_qmp(const char *fmt, va_list ap)
> -{
> - return error_vprintf(fmt, ap);
> -}
When I write a printf-like utility function, I habitually throw in a
vprintf-like function.
Any particular reason for hiding this one? To avoid misunderstandings:
I'm fine with hiding it if it's causing you trouble.
Except I think we'd better delete than hide then: inline into
error_printf_unless_qmp(). Makes sense?
- Re: [PATCH 1/9] monitor: make error_vprintf_unless_qmp() static,
Markus Armbruster <=