From patchwork Thu Aug 24 08:46:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 805348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xdJ2y4tqcz9s8P for ; Thu, 24 Aug 2017 18:52:37 +1000 (AEST) Received: from localhost ([::1]:47295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dknsP-0008Oj-Nf for incoming@patchwork.ozlabs.org; Thu, 24 Aug 2017 04:52:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dknmP-0003PR-16 for qemu-devel@nongnu.org; Thu, 24 Aug 2017 04:46:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dknmN-0000PG-L3 for qemu-devel@nongnu.org; Thu, 24 Aug 2017 04:46:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37694) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dknmN-0000OY-Ex for qemu-devel@nongnu.org; Thu, 24 Aug 2017 04:46:19 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 640E13680F; Thu, 24 Aug 2017 08:46:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 640E13680F Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=armbru@redhat.com Received: from blackfin.pond.sub.org (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90AC46E0DD; Thu, 24 Aug 2017 08:46:17 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id CEF1111386D3; Thu, 24 Aug 2017 10:46:11 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Thu, 24 Aug 2017 10:46:09 +0200 Message-Id: <1503564371-26090-15-git-send-email-armbru@redhat.com> In-Reply-To: <1503564371-26090-1-git-send-email-armbru@redhat.com> References: <1503564371-26090-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 24 Aug 2017 08:46:18 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 14/16] qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Markus Armbruster Reviewed-by: Marc-André Lureau --- hw/core/qdev-properties.c | 7 +++++-- qapi/qapi-visit-core.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 078fc5d..7512bd4 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -72,7 +72,9 @@ static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque, static void set_default_value_enum(Object *obj, const Property *prop) { - object_property_set_str(obj, prop->info->enum_table[prop->defval.i], + object_property_set_str(obj, + qapi_enum_lookup(prop->info->enum_table, + prop->defval.i), prop->name, &error_abort); } @@ -1095,7 +1097,8 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value) Property *prop; prop = qdev_prop_find(dev, name); - object_property_set_str(OBJECT(dev), prop->info->enum_table[value], + object_property_set_str(OBJECT(dev), + qapi_enum_lookup(prop->info->enum_table, value), name, &error_abort); } diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index f285879..30dc85b 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -345,7 +345,7 @@ static void output_type_enum(Visitor *v, const char *name, int *obj, return; } - enum_str = (char *)strings[value]; + enum_str = (char *)qapi_enum_lookup(strings, value); visit_type_str(v, name, &enum_str, errp); }