From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgBcK-0000po-BR for qemu-devel@nongnu.org; Fri, 02 May 2014 07:27:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgBc8-0007Vy-Ga for qemu-devel@nongnu.org; Fri, 02 May 2014 07:27:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgBc8-0007Vo-9I for qemu-devel@nongnu.org; Fri, 02 May 2014 07:26:48 -0400 From: Markus Armbruster Date: Fri, 2 May 2014 13:26:32 +0200 Message-Id: <1399030002-27222-5-git-send-email-armbru@redhat.com> In-Reply-To: <1399030002-27222-1-git-send-email-armbru@redhat.com> References: <1399030002-27222-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v3 04/14] error: Consistently name Error ** objects errp, and not err List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- include/qapi/error.h | 27 ++++++++++++++++----------- util/error.c | 8 ++++---- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/include/qapi/error.h b/include/qapi/error.h index c0f0c3b..7995801 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -27,14 +27,16 @@ typedef struct Error Error; * printf-style human message. This function is not meant to be used outside * of QEMU. */ -void error_set(Error **err, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(3, 4); +void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...) + GCC_FMT_ATTR(3, 4); /** * Set an indirect pointer to an error given a ErrorClass value and a * printf-style human message, followed by a strerror() string if * @os_error is not zero. */ -void error_set_errno(Error **err, int os_error, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(4, 5); +void error_set_errno(Error **errp, int os_error, ErrorClass err_class, + const char *fmt, ...) GCC_FMT_ATTR(4, 5); #ifdef _WIN32 /** @@ -42,19 +44,22 @@ void error_set_errno(Error **err, int os_error, ErrorClass err_class, const char * printf-style human message, followed by a g_win32_error_message() string if * @win32_err is not zero. */ -void error_set_win32(Error **err, int win32_err, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(4, 5); +void error_set_win32(Error **errp, int win32_err, ErrorClass err_class, + const char *fmt, ...) GCC_FMT_ATTR(4, 5); #endif /** * Same as error_set(), but sets a generic error */ -#define error_setg(err, fmt, ...) \ - error_set(err, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__) -#define error_setg_errno(err, os_error, fmt, ...) \ - error_set_errno(err, os_error, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__) +#define error_setg(errp, fmt, ...) \ + error_set(errp, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__) +#define error_setg_errno(errp, os_error, fmt, ...) \ + error_set_errno(errp, os_error, ERROR_CLASS_GENERIC_ERROR, \ + fmt, ## __VA_ARGS__) #ifdef _WIN32 -#define error_setg_win32(err, win32_err, fmt, ...) \ - error_set_win32(err, win32_err, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__) +#define error_setg_win32(errp, win32_err, fmt, ...) \ + error_set_win32(errp, win32_err, ERROR_CLASS_GENERIC_ERROR, \ + fmt, ## __VA_ARGS__) #endif /** @@ -66,7 +71,7 @@ void error_setg_file_open(Error **errp, int os_errno, const char *filename); * Returns true if an indirect pointer to an error is pointing to a valid * error object. */ -bool error_is_set(Error **err); +bool error_is_set(Error **errp); /* * Get the error class of an error object. @@ -88,7 +93,7 @@ const char *error_get_pretty(Error *err); * always transfer ownership of the error reference and handles the case where * dst_err is NULL correctly. Errors after the first are discarded. */ -void error_propagate(Error **dst_err, Error *local_err); +void error_propagate(Error **dst_errp, Error *local_err); /** * Free an error object. diff --git a/util/error.c b/util/error.c index 2bb42e1..66245cc 100644 --- a/util/error.c +++ b/util/error.c @@ -165,13 +165,13 @@ void error_free(Error *err) } } -void error_propagate(Error **dst_err, Error *local_err) +void error_propagate(Error **dst_errp, Error *local_err) { - if (local_err && dst_err == &error_abort) { + if (local_err && dst_errp == &error_abort) { error_report("%s", error_get_pretty(local_err)); abort(); - } else if (dst_err && !*dst_err) { - *dst_err = local_err; + } else if (dst_errp && !*dst_errp) { + *dst_errp = local_err; } else if (local_err) { error_free(local_err); } -- 1.8.1.4