From patchwork Thu Aug 2 01:02:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 174644 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 50A232C0090 for ; Thu, 2 Aug 2012 11:50:15 +1000 (EST) Received: from localhost ([::1]:43315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swjpe-0005VT-4y for incoming@patchwork.ozlabs.org; Wed, 01 Aug 2012 21:04:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwjoS-0003xy-N4 for qemu-devel@nongnu.org; Wed, 01 Aug 2012 21:02:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SwjoR-0003KA-DA for qemu-devel@nongnu.org; Wed, 01 Aug 2012 21:02:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwjoR-0003Jx-39 for qemu-devel@nongnu.org; Wed, 01 Aug 2012 21:02:51 -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 q7212mkE019155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 1 Aug 2012 21:02:48 -0400 Received: from localhost (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q7212lgP008218; Wed, 1 Aug 2012 21:02:48 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Wed, 1 Aug 2012 22:02:38 -0300 Message-Id: <1343869374-23417-19-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1343869374-23417-1-git-send-email-lcapitulino@redhat.com> References: <1343869374-23417-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 18/34] error: drop unused functions 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 Besides of being unused, they operate on the current error format, which is going to be replaced soon. Useful replacements for the dropped functions will be added along with the new error format. Signed-off-by: Luiz Capitulino --- error.c | 48 ------------------------------------------------ error.h | 16 ---------------- error_int.h | 1 - 3 files changed, 65 deletions(-) diff --git a/error.c b/error.c index 2ade99b..216cb08 100644 --- a/error.c +++ b/error.c @@ -65,29 +65,6 @@ const char *error_get_pretty(Error *err) return err->msg; } -const char *error_get_field(Error *err, const char *field) -{ - if (strcmp(field, "class") == 0) { - return qdict_get_str(err->obj, field); - } else { - QDict *dict = qdict_get_qdict(err->obj, "data"); - return qdict_get_str(dict, field); - } -} - -QDict *error_get_data(Error *err) -{ - QDict *data = qdict_get_qdict(err->obj, "data"); - QINCREF(data); - return data; -} - -void error_set_field(Error *err, const char *field, const char *value) -{ - QDict *dict = qdict_get_qdict(err->obj, "data"); - qdict_put(dict, field, qstring_from_str(value)); -} - void error_free(Error *err) { if (err) { @@ -97,31 +74,6 @@ void error_free(Error *err) } } -bool error_is_type(Error *err, const char *fmt) -{ - const char *error_class; - char *ptr; - char *end; - - if (!err) { - return false; - } - - ptr = strstr(fmt, "'class': '"); - assert(ptr != NULL); - ptr += strlen("'class': '"); - - end = strchr(ptr, '\''); - assert(end != NULL); - - error_class = error_get_field(err, "class"); - if (strlen(error_class) != end - ptr) { - return false; - } - - return strncmp(ptr, error_class, end - ptr) == 0; -} - void error_propagate(Error **dst_err, Error *local_err) { if (dst_err && !*dst_err) { diff --git a/error.h b/error.h index 3d9d96d..3d038a5 100644 --- a/error.h +++ b/error.h @@ -45,16 +45,6 @@ Error *error_copy(const Error *err); const char *error_get_pretty(Error *err); /** - * Get an individual named error field. - */ -const char *error_get_field(Error *err, const char *field); - -/** - * Get an individual named error field. - */ -void error_set_field(Error *err, const char *field, const char *value); - -/** * Propagate an error to an indirect pointer to an error. This function will * always transfer ownership of the error reference and handles the case where * dst_err is NULL correctly. Errors after the first are discarded. @@ -66,10 +56,4 @@ void error_propagate(Error **dst_err, Error *local_err); */ void error_free(Error *err); -/** - * Determine if an error is of a speific type (based on the qerror format). - * Non-QEMU users should get the `class' field to identify the error type. - */ -bool error_is_type(Error *err, const char *fmt); - #endif diff --git a/error_int.h b/error_int.h index 5e39424..4b00d08 100644 --- a/error_int.h +++ b/error_int.h @@ -22,7 +22,6 @@ * * These are used to convert QErrors to Errors */ -QDict *error_get_data(Error *err); QObject *error_get_qobject(Error *err); void error_set_qobject(Error **errp, QObject *obj);