From patchwork Fri Apr 12 07:33:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 788263 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp591145wrm; Fri, 12 Apr 2024 00:36:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVMOW8Gr31NeEC1VONWmrr5ViT6D6dDO1uxtmsUURnUu0SVUNKV5pNSucQY0LzdnU1FHf+IBodUOqYAHV1f/fVC X-Google-Smtp-Source: AGHT+IHYvhFvbkGr5QreDe4bw8+28M7/QqTfpsbJQ4GmS1fNjfuoXnnld8Tj9YdlwfOIX3CVkQMi X-Received: by 2002:ac8:58c1:0:b0:434:bf8a:6554 with SMTP id u1-20020ac858c1000000b00434bf8a6554mr2175267qta.52.1712907401039; Fri, 12 Apr 2024 00:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712907401; cv=none; d=google.com; s=arc-20160816; b=Q+KKV0MQiOh39KqB7U4DSo68+kuZRl0vwj8zuQ6xtW+ieRWGQvYDrqHsZ7x45Y4DE3 Kcs3tyggbGpyz5WA4lXQVyEGXzpi5dWujZTbtRUSRS8k5PsFdtenq/IfFqQ+EPSp6J5f /0DK6AAgiKRCOqBSvmgnYH0j1GL831r/W4eTfVa4yn6UO7M2p0UV4KzrbDTfjUiqcWM3 4A7gsdkcv4rd0v3Q4bImdchOPxuxoWMVxpnOHASd19phFTlZBu1kou0fBz+i6fKHQALb 7VM3LdyEtGEPbssWvDTMFHeqMAQ3NtRFMmZknDg84YnB0nM4yv3dpkphzDyABiR9Epel eZyA== 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=6ilxVF5BFwS4yjUJP5brLaFANRlAZicyrMWrO+XSuc0=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=KjJ2+NeYyak+BSojrdMnAYEp4urvz9wjJ4RZIDxY8M/0e6AuFB7q8bX3+sNv/2L6t3 X7wPI8I5hqE4QJN4xGtt/LSNqMuy4kZ9nJZ161zPhA3gGGesw1H0OhiNjuBnaH5kaeo3 hBl5qxd9IxTn/wj4Y7cVR7g0lzQ6grS9h9ZxLlT9lS5K0IDuxsePWch6T9Y/ph/YnuDG C8y1Ei4mB/lEruKUbzhBQuKyCCSF1pcvBOnrRjGcdbDrXm9dWug6l71itTRUPU7ph363 QJEQgcly8lhoxWWualfgJBp52jO93uUk9kr/bsYVMvxqCWVEUM62on3LZQ3defaaBgHZ joqA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TZXSFWDs; 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 d16-20020a05622a05d000b0043467b97307si3239779qtb.21.2024.04.12.00.36.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Apr 2024 00:36:41 -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=TZXSFWDs; 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 1rvBQ8-00070j-1J; Fri, 12 Apr 2024 03:34:00 -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 1rvBQ6-00070C-ER for qemu-devel@nongnu.org; Fri, 12 Apr 2024 03:33:58 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rvBQ4-00078P-Va for qemu-devel@nongnu.org; Fri, 12 Apr 2024 03:33:58 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1e5c11076b9so640725ad.3 for ; Fri, 12 Apr 2024 00:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712907235; x=1713512035; 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=6ilxVF5BFwS4yjUJP5brLaFANRlAZicyrMWrO+XSuc0=; b=TZXSFWDsAsMGQVsYPjBqDchaQDmbOPAHKM/mgPJZFKOqGbDHoFqE4DMQTolwJT/oPm eOGKEAk3lg4DGoTK9ZxQQRwo6OMgkkM67eYoF/rRZoqW804imrnbw14AJgpmL1lezudM a6EG09maLY4M/phWqabf8jytQRcGNq08Fb0HzpjJmkeOpwZs5MJQtiwPCpiUGew22ZBe 3VVYNIXpThn5fnOObzkVzxohofOnGOJMvFEKsWeoeP4681R0vQTBZGeLv9+3tUwqF4MT NOjIelZwb11j1Qlpbz0cQid/SEqf48j1mN2FarH0ufaUoeGlqkEOf8xOm9jLzPy7LnrX 3Ffw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712907235; x=1713512035; 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=6ilxVF5BFwS4yjUJP5brLaFANRlAZicyrMWrO+XSuc0=; b=baQwoQO5atYM08PmEa8jorRxcv0EAN8KH9XvosgMt9lUuFfsAGopK/6NP8ndEDJnR4 S4++yolis/J7p27lGWN8gRbG0i/n1g1l16Oy75Ox7MBiaPOYmaaIX0hsY92Jl/YbIpvX ynItaMcZhmQQBSCbUXmToDEIbgtyryEIkT/pvrpTpg1OYIdC45Rahbw0HV3oow82wUQB wVvHzMHT4hQ6DlkPekceNJOsT4fuF/C4KkMzyRUgRyKkDsaUwuHbNStwi/C1+i+zNwRf korrMZegqP4OBhbV0bzCdsALE7t6dDboiyq33KOWKc4FNGpJskSvz5wFyF4tbEpnxvQR wzKQ== X-Gm-Message-State: AOJu0YyHqfBGS1vKELy7eEV0+EKOU5jzJ915aEfJizH+Wp4APjcbnWbv WOVOATm3IXuoWW1HqQkFjXEC1n9q7xH0mEo7NxhX5pG1jXRdw0ClFBGGJfLPvXY15mPCTYoma8K z X-Received: by 2002:a17:902:f64a:b0:1e3:ff5e:159f with SMTP id m10-20020a170902f64a00b001e3ff5e159fmr2442098plg.18.1712907235663; Fri, 12 Apr 2024 00:33:55 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id e5-20020a17090301c500b001e556734814sm2206099plh.134.2024.04.12.00.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:33:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 10/27] hw/dma/pl330: Use qemu_hexdump_line to avoid sprintf Date: Fri, 12 Apr 2024 00:33:29 -0700 Message-Id: <20240412073346.458116-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412073346.458116-1-richard.henderson@linaro.org> References: <20240412073346.458116-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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 From: Philippe Mathieu-Daudé 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é Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- 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 @@ */ #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 { static void pl330_hexdump(uint8_t *buf, size_t size) { - unsigned int b, i, len; - char tmpbuf[80]; + g_autoptr(GString) str = g_string_sized_new(64); + size_t b, len; - for (b = 0; b < size; b += 16) { - len = size - b; - if (len > 16) { - len = 16; - } - tmpbuf[0] = '\0'; - for (i = 0; i < len; i++) { - if ((i % 4) == 0) { - strcat(tmpbuf, " "); - } - sprintf(tmpbuf + strlen(tmpbuf), " %02x", buf[b + i]); - } - trace_pl330_hexdump(b, tmpbuf); + for (b = 0; b < size; b += len) { + len = MIN(16, size - b); + g_string_truncate(str, 0); + qemu_hexdump_line(str, buf + b, len, 1, 4); + trace_pl330_hexdump(b, str->str); } }