All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-for-5.2] qapi/error: Make error_vprepend() static
@ 2020-07-23 10:14 Philippe Mathieu-Daudé
  2020-07-23 10:28 ` Li Qiang
  2020-07-23 11:23 ` Markus Armbruster
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-23 10:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Michael Roth, Markus Armbruster

error_vprepend() is only used by util/error.c where it is
defined. Make it static to reduce its scope.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/qapi/error.h | 6 ------
 util/error.c         | 6 +++++-
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/include/qapi/error.h b/include/qapi/error.h
index 7932594dce..fa2308dedd 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -384,12 +384,6 @@ void error_propagate(Error **dst_errp, Error *local_err);
 void error_propagate_prepend(Error **dst_errp, Error *local_err,
                              const char *fmt, ...);
 
-/*
- * Prepend some text to @errp's human-readable error message.
- * The text is made by formatting @fmt, @ap like vprintf().
- */
-void error_vprepend(Error *const *errp, const char *fmt, va_list ap);
-
 /*
  * Prepend some text to @errp's human-readable error message.
  * The text is made by formatting @fmt, ... like printf().
diff --git a/util/error.c b/util/error.c
index b6c89d1412..3990b741ff 100644
--- a/util/error.c
+++ b/util/error.c
@@ -121,7 +121,11 @@ void error_setg_file_open_internal(Error **errp,
                               "Could not open '%s'", filename);
 }
 
-void error_vprepend(Error *const *errp, const char *fmt, va_list ap)
+/*
+ * Prepend some text to @errp's human-readable error message.
+ * The text is made by formatting @fmt, @ap like vprintf().
+ */
+static void error_vprepend(Error *const *errp, const char *fmt, va_list ap)
 {
     GString *newmsg;
 
-- 
2.21.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH-for-5.2] qapi/error: Make error_vprepend() static
  2020-07-23 10:14 [PATCH-for-5.2] qapi/error: Make error_vprepend() static Philippe Mathieu-Daudé
@ 2020-07-23 10:28 ` Li Qiang
  2020-07-23 11:23 ` Markus Armbruster
  1 sibling, 0 replies; 3+ messages in thread
From: Li Qiang @ 2020-07-23 10:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Markus Armbruster, Qemu Developers, Michael Roth

Philippe Mathieu-Daudé <philmd@redhat.com> 于2020年7月23日周四 下午6:15写道:
>
> error_vprepend() is only used by util/error.c where it is
> defined. Make it static to reduce its scope.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Li Qiang <liq3ea@gmail.com>

> ---
>  include/qapi/error.h | 6 ------
>  util/error.c         | 6 +++++-
>  2 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index 7932594dce..fa2308dedd 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -384,12 +384,6 @@ void error_propagate(Error **dst_errp, Error *local_err);
>  void error_propagate_prepend(Error **dst_errp, Error *local_err,
>                               const char *fmt, ...);
>
> -/*
> - * Prepend some text to @errp's human-readable error message.
> - * The text is made by formatting @fmt, @ap like vprintf().
> - */
> -void error_vprepend(Error *const *errp, const char *fmt, va_list ap);
> -
>  /*
>   * Prepend some text to @errp's human-readable error message.
>   * The text is made by formatting @fmt, ... like printf().
> diff --git a/util/error.c b/util/error.c
> index b6c89d1412..3990b741ff 100644
> --- a/util/error.c
> +++ b/util/error.c
> @@ -121,7 +121,11 @@ void error_setg_file_open_internal(Error **errp,
>                                "Could not open '%s'", filename);
>  }
>
> -void error_vprepend(Error *const *errp, const char *fmt, va_list ap)
> +/*
> + * Prepend some text to @errp's human-readable error message.
> + * The text is made by formatting @fmt, @ap like vprintf().
> + */
> +static void error_vprepend(Error *const *errp, const char *fmt, va_list ap)
>  {
>      GString *newmsg;
>
> --
> 2.21.3
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* (no subject)
  2020-07-23 10:14 [PATCH-for-5.2] qapi/error: Make error_vprepend() static Philippe Mathieu-Daudé
  2020-07-23 10:28 ` Li Qiang
@ 2020-07-23 11:23 ` Markus Armbruster
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2020-07-23 11:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Michael Roth

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> error_vprepend() is only used by util/error.c where it is
> defined. Make it static to reduce its scope.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  include/qapi/error.h | 6 ------
>  util/error.c         | 6 +++++-
>  2 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index 7932594dce..fa2308dedd 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -384,12 +384,6 @@ void error_propagate(Error **dst_errp, Error *local_err);
>  void error_propagate_prepend(Error **dst_errp, Error *local_err,
>                               const char *fmt, ...);
>  
> -/*
> - * Prepend some text to @errp's human-readable error message.
> - * The text is made by formatting @fmt, @ap like vprintf().
> - */
> -void error_vprepend(Error *const *errp, const char *fmt, va_list ap);
> -
>  /*
>   * Prepend some text to @errp's human-readable error message.
>   * The text is made by formatting @fmt, ... like printf().
> diff --git a/util/error.c b/util/error.c
> index b6c89d1412..3990b741ff 100644
> --- a/util/error.c
> +++ b/util/error.c
> @@ -121,7 +121,11 @@ void error_setg_file_open_internal(Error **errp,
>                                "Could not open '%s'", filename);
>  }
>  
> -void error_vprepend(Error *const *errp, const char *fmt, va_list ap)
> +/*
> + * Prepend some text to @errp's human-readable error message.
> + * The text is made by formatting @fmt, @ap like vprintf().
> + */
> +static void error_vprepend(Error *const *errp, const char *fmt, va_list ap)
>  {
>      GString *newmsg;

I prefer to keep error_vprepend() in error.h even though it's only used
in error.c at the moment.

In an external library interface, every ... function needs a va_list
buddy.

This is an internal interface, where providing only a ... function is
just fine.  I happily do that when I have no use fo the va_list
function.  But when the va_list function exists, hiding it buys us
nothing.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-23 11:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23 10:14 [PATCH-for-5.2] qapi/error: Make error_vprepend() static Philippe Mathieu-Daudé
2020-07-23 10:28 ` Li Qiang
2020-07-23 11:23 ` Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.