From patchwork Tue Aug 7 15:53:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 175721 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 91DB62C00AD for ; Wed, 8 Aug 2012 02:24:02 +1000 (EST) Received: from localhost ([::1]:40176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sym6c-0006HO-9B for incoming@patchwork.ozlabs.org; Tue, 07 Aug 2012 11:54:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sym6F-0005Qg-Qs for qemu-devel@nongnu.org; Tue, 07 Aug 2012 11:53:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sym68-0005YK-0j for qemu-devel@nongnu.org; Tue, 07 Aug 2012 11:53:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sym67-0005Y6-KH for qemu-devel@nongnu.org; Tue, 07 Aug 2012 11:53:31 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q77FrTpM030571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 Aug 2012 11:53:29 -0400 Received: from localhost (ovpn-113-157.phx2.redhat.com [10.3.113.157]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q77FrRqW015791; Tue, 7 Aug 2012 11:53:29 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2012 12:53:18 -0300 Message-Id: <1344354826-10375-8-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1344354826-10375-1-git-send-email-lcapitulino@redhat.com> References: <1344354826-10375-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, aliguori@us.ibm.com, armbru@redhat.com, mdroth@linux.vnet.ibm.com, pbonzini@redhat.com, eblake@redhat.com Subject: [Qemu-devel] [PATCH 07/35] qerror: QError: drop file, linenr, func X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org They have never been fully used and conflict with future error improvements. Also makes qerror_report() a proper function, as there's no point in having it as a macro anymore. Signed-off-by: Luiz Capitulino --- qerror.c | 20 +++----------------- qerror.h | 8 +------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/qerror.c b/qerror.c index e717496..6f9f49c 100644 --- a/qerror.c +++ b/qerror.c @@ -404,27 +404,14 @@ static const QErrorStringTable *get_desc_no_fail(const char *fmt) /** * qerror_from_info(): Create a new QError from error information * - * The information consists of: - * - * - file the file name of where the error occurred - * - linenr the line number of where the error occurred - * - func the function name of where the error occurred - * - fmt JSON printf-like dictionary, there must exist keys 'class' and - * 'data' - * - va va_list of all arguments specified by fmt - * * Return strong reference. */ -static QError *qerror_from_info(const char *file, int linenr, const char *func, - const char *fmt, va_list *va) +static QError *qerror_from_info(const char *fmt, va_list *va) { QError *qerr; qerr = qerror_new(); loc_save(&qerr->loc); - qerr->linenr = linenr; - qerr->file = file; - qerr->func = func; qerr->error = error_obj_from_fmt_no_fail(fmt, va); qerr->entry = get_desc_no_fail(fmt); @@ -545,14 +532,13 @@ static void qerror_print(QError *qerror) QDECREF(qstring); } -void qerror_report_internal(const char *file, int linenr, const char *func, - const char *fmt, ...) +void qerror_report(const char *fmt, ...) { va_list va; QError *qerror; va_start(va, fmt); - qerror = qerror_from_info(file, linenr, func, fmt, &va); + qerror = qerror_from_info(fmt, &va); va_end(va); if (monitor_cur_is_qmp()) { diff --git a/qerror.h b/qerror.h index fe8870c..3c0b14c 100644 --- a/qerror.h +++ b/qerror.h @@ -27,20 +27,14 @@ typedef struct QError { QObject_HEAD; QDict *error; Location loc; - int linenr; - const char *file; - const char *func; const QErrorStringTable *entry; } QError; QString *qerror_human(const QError *qerror); -void qerror_report_internal(const char *file, int linenr, const char *func, - const char *fmt, ...) GCC_FMT_ATTR(4, 5); +void qerror_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void qerror_report_err(Error *err); void assert_no_error(Error *err); QString *qerror_format(const char *fmt, QDict *error); -#define qerror_report(fmt, ...) \ - qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__) /* * QError class list