On 10/11/19 11:03 AM, Vladimir Sementsov-Ogievskiy wrote:
Error **errp is almost always OUT-argument: it's assumed to be NULL, or
pointer to NULL-initialized pointer, or pointer to error_abort or
error_fatal, for callee to report error.

But very few functions instead get Error **errp as IN-argument:
it's assumed to be set (or, maybe, NULL), and callee should clean it,
or add some information.

In such cases, rename errp to errp_in.

This patch updates only error API functions. There still a few
functions with errp-in semantics, they will be updated in further
commits.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com>
---
  include/qapi/error.h |  8 ++++----
  util/error.c         | 30 +++++++++++++++---------------
  2 files changed, 19 insertions(+), 19 deletions(-)


+++ b/include/qapi/error.h
@@ -233,13 +233,13 @@ void error_propagate_prepend(Error **dst_errp, Error 
*local_err,
   * Prepend some text to @errp's human-readable error message.
   * The text is made by formatting @fmt, @ap like vprintf().
   */
-void error_vprepend(Error **errp, const char *fmt, va_list ap);
+void error_vprepend(Error **errp_in, const char *fmt, va_list ap);

Fails to update the comment.

/*
   * Prepend some text to @errp's human-readable error message.
   * The text is made by formatting @fmt, ... like printf().
   */
-void error_prepend(Error **errp, const char *fmt, ...)
+void error_prepend(Error **errp_in, const char *fmt, ...)

and again

      GCC_FMT_ATTR(2, 3);
/*
@@ -256,7 +256,7 @@ void error_prepend(Error **errp, const char *fmt, ...)
   * May be called multiple times.  The resulting hint should end with a
   * newline.
   */
-void error_append_hint(Error **errp, const char *fmt, ...)
+void error_append_hint(Error **errp_in, const char *fmt, ...)
      GCC_FMT_ATTR(2, 3);
/*
@@ -283,7 +283,7 @@ void error_free(Error *err);
  /*
   * Convenience function to assert that *@errp is set, then silently free it.
   */
-void error_free_or_abort(Error **errp);
+void error_free_or_abort(Error **errp_in);

and again.

Otherwise makes sense; if matching comments are the only things changed,

Reviewed-by: Eric Blake <ebl...@redhat.com>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Reply via email to