From patchwork Thu Apr 25 11:01:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 792035 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1320234wrq; Thu, 25 Apr 2024 04:04:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWRAb8RYfW4eTp9ORhyFEm6eXq/PGUtPi8zD4GdEBiWfMQXaP6iNlay2LAut4/8Z149MIN3mBtFzkm8PTBFW3vQ X-Google-Smtp-Source: AGHT+IFA4hOaJuM46la00fFMzXWVGtRqZ3LdTXm5lCVnS/WbZlHK4mZhsXv+IKCa3u2wWCmyqql+ X-Received: by 2002:a05:622a:50e:b0:43a:1d94:c573 with SMTP id l14-20020a05622a050e00b0043a1d94c573mr3828118qtx.22.1714043082943; Thu, 25 Apr 2024 04:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714043082; cv=none; d=google.com; s=arc-20160816; b=siYmgilBIzjEqhx/vqT463syKV27NVKTeaWX28z/sJWprRgVCqibW6AYudMdrnL7v1 /3xzIN5Hwt0Pg4Nxe8NAGnGYyzF9smJ8ams4be3DbeU32THdbJVtqyn9C9bIuDW51G4A dzLKvmuFBgUCAhEx/2vRBUHfBaa/AQfLKj8deiBvpvfK5dcXvsyWgiyR+bYukncYhiSm Ehzg9Z3wXvT1Q5QeaAVAckK8LCvGXswDvCDJdJHFvWe3cl/KXSdkdkiDpfMPwEwygcFU FOBHJs9CTTrqFpO08tp/2fhn1yOEPC0uE6N48L1xMK1EmsaLWZoO8gPOraPlskgqE0JF pgbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Rf1txhvOtU9A895EpVlfVLIui0ISU1TQahG+lZi6+b0=; fh=AjJiCaOEq0bW3CFUfoWHOyxbijSvAbMfggVIeNtEb5U=; b=AB6390AglcsZLW7U2czDOC9HLl2+HzPhslgn/P93MnSGhuwtbuB0am2nGFWd2IwD5v yWMo7+7iWQD8rPS3BAQfFNK4DB+xypVcHOVgIt+8UsX8tFMXD6J49cMtoway02OlpjJd 6IgLgvyiGe2kwPiBRfZwN+zQBJEeae+8kFDEIEUg944v0sTqFisiZ/+VyZZviK0U4AKP +TfBcuHW44w8FevHm84CFSopvUrc4s010NJBzu/A1yJY3A0JjqLDkELnfnNM2WE5J1+2 b0n5KCSV1WcPeWJlt5JOg9NBuFh8MPmCqxDh/k2KdGiJemNe2BNkDwWk8//n2+jv5UsP /RTA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PR5ClGRq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h9-20020ac85e09000000b004373d1346d5si17480293qtx.666.2024.04.25.04.04.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Apr 2024 04:04:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PR5ClGRq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzwtw-0001dQ-KL; Thu, 25 Apr 2024 07:04:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzwsS-0008DM-NX for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:58 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzwsP-0008No-VT for qemu-devel@nongnu.org; Thu, 25 Apr 2024 07:02:55 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-41b5dd5aefaso1540755e9.2 for ; Thu, 25 Apr 2024 04:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714042972; x=1714647772; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rf1txhvOtU9A895EpVlfVLIui0ISU1TQahG+lZi6+b0=; b=PR5ClGRqgiiosD0JZPWcJyUawvI/ODaN7ZRYcLTZK25JoSDmN77cwLSCk3vgFT3icb rKIrpjor+xpY43qJFwdZp6sV86OTYz6J5RqnB/1/QQqwUzvJMjo4iWlCvqNgrKZrv+cX VMg8MtpQV+r/3SERfoQ4b8dqFox6QTZmMkUGZw7Z2UfaWUmSJB1YUirw7UvrTtvN8rm9 tNfifvy9h13SIE8NRef3T8UwD5UKshoBLO7CEFSB/Zyj68F9oK7K3ZVB4XNQlGCC8JJR YWzHph8ohRhGMlhx2937TxhMWxwS+p+aSzHOAQEjXi2QMZpweYU9jHzton+saQYbcU7m s9ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714042972; x=1714647772; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rf1txhvOtU9A895EpVlfVLIui0ISU1TQahG+lZi6+b0=; b=ivAQM0MiOy5fVDbXn8JYIuXcwisT70XAgFH4r0HqK1cGVPouMT08xC5ZIj+Zl2O5Df XXThUSJlw99vzSKAMJo+T16kTbxnHxj0JMSlz3CJmuco0mNn/6MpNSibqRU/nAQ6OGu6 L76JX8yszRDKgCKTQmY9rVd5MY+DVjSuKlfTXgIZ3CI/TqyhBD4rPLJ6FR68rebQkMup RTIAWTWM88sS8F62dSRP4dCjrqs+VjJPITxY7W4BrgR7ZQajuVk35MXttnBhLx2q+IHT g4TtR0UuG8rcf2xpNAopJt/8UrQimNcEPNqpo8MupbYs8/uTWQgerkPAPs/Ri4Wyt3j3 uiQw== X-Gm-Message-State: AOJu0YwHgov8w0/YY5jWLwA5XczQHLcAQS/6pNctgwCc+lN5C1wXAT9s N4UghdG3Us5lCeFGuh2zrBuIWcvGvt7fdWJTiUfTxWW3dWJXUQrgdkDDpTEcq1QJP+b6MSLpZ9x M X-Received: by 2002:a05:600c:4ec9:b0:41a:bf5d:c30a with SMTP id g9-20020a05600c4ec900b0041abf5dc30amr5646980wmq.18.1714042972013; Thu, 25 Apr 2024 04:02:52 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.77]) by smtp.gmail.com with ESMTPSA id c9-20020a05600c0a4900b0041b43d2d745sm2089435wmq.7.2024.04.25.04.02.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 25 Apr 2024 04:02:51 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Richard Henderson , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PULL 09/22] hw/riscv/virt: Replace sprintf by g_strdup_printf Date: Thu, 25 Apr 2024 13:01:42 +0200 Message-ID: <20240425110157.20328-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240425110157.20328-1-philmd@linaro.org> References: <20240425110157.20328-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1. Use g_strdup_printf instead. Signed-off-by: Philippe Mathieu-Daudé [rth: Use g_strdup_printf] Signed-off-by: Richard Henderson Message-Id: <20240412073346.458116-26-richard.henderson@linaro.org> --- hw/riscv/virt.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index d171e74f7b..4fdb660525 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1617,10 +1617,8 @@ static void virt_machine_instance_init(Object *obj) static char *virt_get_aia_guests(Object *obj, Error **errp) { RISCVVirtState *s = RISCV_VIRT_MACHINE(obj); - char val[32]; - sprintf(val, "%d", s->aia_guests); - return g_strdup(val); + return g_strdup_printf("%d", s->aia_guests); } static void virt_set_aia_guests(Object *obj, const char *val, Error **errp) @@ -1741,7 +1739,6 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, static void virt_machine_class_init(ObjectClass *oc, void *data) { - char str[128]; MachineClass *mc = MACHINE_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); @@ -1767,7 +1764,6 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); #endif - object_class_property_add_bool(oc, "aclint", virt_get_aclint, virt_set_aclint); object_class_property_set_description(oc, "aclint", @@ -1785,9 +1781,14 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) object_class_property_add_str(oc, "aia-guests", virt_get_aia_guests, virt_set_aia_guests); - sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid value " - "should be between 0 and %d.", VIRT_IRQCHIP_MAX_GUESTS); - object_class_property_set_description(oc, "aia-guests", str); + { + g_autofree char *str = + g_strdup_printf("Set number of guest MMIO pages for AIA IMSIC. " + "Valid value should be between 0 and %d.", + VIRT_IRQCHIP_MAX_GUESTS); + object_class_property_set_description(oc, "aia-guests", str); + } + object_class_property_add(oc, "acpi", "OnOffAuto", virt_get_acpi, virt_set_acpi, NULL, NULL);