From nobody Mon Nov 25 04:52:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1717622351; cv=none; d=zohomail.com; s=zohoarc; b=H18kcr4KR0dmhtm3wIzwxKxXy/w8+kBhPyPQfizeogiUW0hFV5a7CfJIKgbcbvH+iStfzazLbgi2n0Jdn0Xl7e5oFA57WyYoG/6Ed2EBFu2HyryijAi3ABqntC4MRPkoW5CCG8UKIIXBtSH2gl9pEbdRCeC4i7FwogaEadtVuWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717622351; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L6Mj0yPmK4aF2gdBWUJi8XJKeBX80hKgL2mV428joew=; b=GNi/Np3UbV8FF2mh5DiZe+BlZWZjA0/9tTR2TH1obpeLZQhLJsp5Swnvlx5r9sXc14wz9XRuC5bmfpMn/rkFpLV7anQzDCk3SF5W9n3Ng2HgY15vutq0ATYaHrvA8QbV5AUEl86g8afkCWRHEhR1SxxvH5GlxJwDhnTDlQs7pqc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717622351301948.8365038426995; Wed, 5 Jun 2024 14:19:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sExz6-0000hL-TI; Wed, 05 Jun 2024 17:15:52 -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 1sExyw-0000dS-L4 for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:44 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sExym-0003QF-T0 for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:40 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-7025b253f64so210725b3a.3 for ; Wed, 05 Jun 2024 14:15:31 -0700 (PDT) Received: from stoup.. ([71.212.132.216]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70242aec7d0sm9347538b3a.99.2024.06.05.14.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717622130; x=1718226930; 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=L6Mj0yPmK4aF2gdBWUJi8XJKeBX80hKgL2mV428joew=; b=X9U12m3ZOWpkFESkavbYaNI0cWJ6ox6wsAwDBdUmcVj7DySqYHVscny641v/NgXxB4 XPr6pcnCovVesTMDBWgzvVQgLR4L6aLsuSrqOisQ7JWipd7iizvY4lnOy9LV8K4ew4eu vwaBM8E3+sSZZ2laPJkiz28l2LEhG7MKRWHEaXS0DDBH41kB+TBRTgHoGtUdWBOamUsN N2wqfgVTjpjLzI3unmyHI7lefazyks5uscKkSuY2dxOFR3EeJdQdcRXmzm+mXHGWflle /ZEJdQgeIwjNWsRWPrmM4voVVtEbiLCG/GoHywDj6E0We1r9UwYQplkHcr8Uyow/+g8T KJRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717622130; x=1718226930; 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=L6Mj0yPmK4aF2gdBWUJi8XJKeBX80hKgL2mV428joew=; b=aGoktzJvtrpWODXBxutJnupwwHIXwJ/k6BMLhebehCEweeuDsCRYJnWLehCqv7LDZW JGqdDRGTo+4Cr8s/k58gjL8paRDiWv3oHzbKO9OkVK37ZT1a5ryILHZbvmrA9Horygb8 c/B6EIhzyI7UrQFnCI6OwNNB+S+K+3IDIIc4Si3CKZFOkFOWVNaAWdUbj25T+xfvHtgM 00TJ5bUrIh03bpKBlxM0B+s9xxjMuF/5J7bApc+MCbVfUz/ukKhtjNssURtDhzmelyb6 iZ1tdb/LhPBMOw7o5sb8+2BEByE9noULk/q1QhZLsm/o7VpUjXaPfgvo1uS9O5LY4eC+ 13Xg== X-Gm-Message-State: AOJu0YxB/iDkJUiVK48EZyPtRUkXgK0oyXWrf5JQ3kGwh1aBZtoIK/z0 yZuw8kjfnc63YvXtNLXPDXuOGDFCVVwDB5qAnZBpOSkNBelsq0JmgzCgUogyS6iKVne5rm+gRuF c X-Google-Smtp-Source: AGHT+IGhr7BRxb3M94JGDbi3Ok9eB/kGHpddidlKChvChFjLt/9uMsIBU4HbxoE28nfTPCCTSkjIsw== X-Received: by 2002:a05:6a20:918e:b0:1a7:bb6d:6589 with SMTP id adf61e73a8af0-1b2b6fd4af7mr4730011637.29.1717622130022; Wed, 05 Jun 2024 14:15:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PULL 08/16] hw/dma/pl330: Use qemu_hexdump_line to avoid sprintf Date: Wed, 5 Jun 2024 14:15:13 -0700 Message-Id: <20240605211521.577094-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605211521.577094-1-richard.henderson@linaro.org> References: <20240605211521.577094-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1717622352257100003 From: Philippe Mathieu-Daud=C3=A9 sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1. Using qemu_hexdump_line both fixes the deprecation warning and simplifies the code base. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Message-Id: <20240412073346.458116-11-richard.henderson@linaro.org> --- hw/dma/pl330.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c index 70a502d245..5f89295af3 100644 --- a/hw/dma/pl330.c +++ b/hw/dma/pl330.c @@ -15,6 +15,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/sysbus.h" @@ -317,22 +318,14 @@ typedef struct PL330InsnDesc { =20 static void pl330_hexdump(uint8_t *buf, size_t size) { - unsigned int b, i, len; - char tmpbuf[80]; + g_autoptr(GString) str =3D g_string_sized_new(64); + size_t b, len; =20 - for (b =3D 0; b < size; b +=3D 16) { - len =3D size - b; - if (len > 16) { - len =3D 16; - } - tmpbuf[0] =3D '\0'; - for (i =3D 0; i < len; i++) { - if ((i % 4) =3D=3D 0) { - strcat(tmpbuf, " "); - } - sprintf(tmpbuf + strlen(tmpbuf), " %02x", buf[b + i]); - } - trace_pl330_hexdump(b, tmpbuf); + for (b =3D 0; b < size; b +=3D len) { + len =3D MIN(16, size - b); + g_string_truncate(str, 0); + qemu_hexdump_line(str, buf + b, len, 1, 4); + trace_pl330_hexdump(b, str->str); } } =20 --=20 2.34.1