From patchwork Sun Apr 11 13:33:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 1464856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FJCVW35YXz9sW1 for ; Sun, 11 Apr 2021 23:33:07 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lVaD2-0002wx-5r; Sun, 11 Apr 2021 13:33:04 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lVaD0-0002wr-Up for fwts-devel@lists.ubuntu.com; Sun, 11 Apr 2021 13:33:02 +0000 Received: from cpc154979-craw9-2-0-cust193.16-3.cable.virginm.net ([80.193.200.194] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lVaD0-00020a-MP; Sun, 11 Apr 2021 13:33:02 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] fwts_firmware: move feature_names into fwts_firmware_feature_string Date: Sun, 11 Apr 2021 14:33:02 +0100 Message-Id: <20210411133302.1196306-1-colin.king@canonical.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King The scope of array feature_names is limited to function fwts_firmware_feature_string to move the array into the function. Make the read-only struct field 'feature' comst. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_firmware.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c index 25517a17..ba0b939c 100644 --- a/src/lib/src/fwts_firmware.c +++ b/src/lib/src/fwts_firmware.c @@ -26,15 +26,6 @@ static fwts_firmware_type firmware_type; static bool firmware_type_valid; -static const struct { - fwts_firmware_feature feature; - const char name[16]; -} feature_names[] = { - { FWTS_FW_FEATURE_ACPI, "ACPI" }, - { FWTS_FW_FEATURE_DEVICETREE, "devicetree" }, - { FWTS_FW_FEATURE_IPMI, "IPMI" }, -}; - /* * fwts_memory_map_entry_compare() * callback used to sort memory_map entries on start address @@ -86,6 +77,15 @@ int fwts_firmware_features(void) const char *fwts_firmware_feature_string(const fwts_firmware_feature features) { + static const struct { + const fwts_firmware_feature feature; + const char name[16]; + } feature_names[] = { + { FWTS_FW_FEATURE_ACPI, "ACPI" }, + { FWTS_FW_FEATURE_DEVICETREE, "devicetree" }, + { FWTS_FW_FEATURE_IPMI, "IPMI" }, + }; + const int n = FWTS_ARRAY_SIZE(feature_names); static const char sep[] = ", "; static char str[60];