From patchwork Wed Jun 5 21:15:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 801639 Delivered-To: patch@linaro.org Received: by 2002:a5d:5610:0:b0:35b:5a80:51b4 with SMTP id l16csp36561wrv; Wed, 5 Jun 2024 14:17:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVM9BeSwzPN8Lj6833TnQ8qK9CcUmnd7yjEtC/MucGSy2YAhQ7Jg/6n/2Cf4a53/KDahqHCMhI69yLxfG2QSRHX X-Google-Smtp-Source: AGHT+IFRgT9+tKrJCBrcv0+MPyxCDsX8QnQKdjx9Ct/PU4r2thqj8sstuN7NSlr+9/XEwoLtZVRk X-Received: by 2002:a81:b344:0:b0:627:ee15:a93c with SMTP id 00721157ae682-62cbb4d6d0emr38224867b3.17.1717622221254; Wed, 05 Jun 2024 14:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717622221; cv=none; d=google.com; s=arc-20160816; b=IqdnP41SKuiXKKILXESCHTIB/MS1naHqwrWdG/W0cUyIshlkT0gXH0TMTSJsx8sb4Z EVN/XMrp6aLb0Ux8qeL/h9KEHi60tWjHAvrgjQ8L6hGkIfH76x5m0VInsJbSWwrfk1uV qvOWffEljjbkvqFOH1rJ1TZq3nJLNCtJAt/Bs6zxqxsct/SZGgsE2ZOAnsIkxrUZ0139 MPGT0fNmPU8vCN6bul/QYBeRj+h/kcCqul7T/a1MFw4J83EdXc546avFL6MXVaZDLJFE QdB0g4r3yN2VG/H5YUAuUYtehj66A3jlekyHeR8MAsn4FZskRF4m7UaQDhZhpEIXsl60 oE3g== 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=8p2HosDvmS098I1PRmfiW9ZIdsUwMQx7c58R0dSQai4=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=n0sod41H4OHmqcYekmzYgkMyDhtMJwfZojPXlYAfUEMK2bQCabOEgTylAPB3PH8pX7 bAse01LoJA6LYO/5CVaBi6bYc1PGf8Xy+pdr+dWKcFUQyhJISJhkFqr9u/iAG3F1oxF4 yE/pPI/q++GtdfwSxcZQr642yYt5XRQLjOyEaEHWs6lm9PJ042M3e571WlI6rkSKrepl ehzfFM7zj857lOK2QrK5Ega76XlkX0HLgiX9dUN4etdJEugl1rAyhcOsh2UsEragGr2i 5W1LrAtMw0COawodzB9jEAk2eIadyJpLqy7RtEE+CtL2Pfg/i05oryL/ZYH0siWlUlKx mkvQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R0791uS8; 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 6a1803df08f44-6ae4a733b64si1125086d6.73.2024.06.05.14.17.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2024 14:17:01 -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=R0791uS8; 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 1sExyu-0000co-88; Wed, 05 Jun 2024 17:15:41 -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 1sExyt-0000c8-4k for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:39 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sExyi-0003Pq-Q0 for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:36 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-7026ad046a2so193465b3a.2 for ; Wed, 05 Jun 2024 14:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717622127; x=1718226927; 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=8p2HosDvmS098I1PRmfiW9ZIdsUwMQx7c58R0dSQai4=; b=R0791uS8OGP1PWYcA/klgSCD4zbtg8gWGfQsLXvZ+bQM4a1V1RYx8MjtYilRy2UkzW cJ3f99PtFZViwUmKXLpnxabMHuddx4QZbzrARxdY80QlnM6xV6IiwIS0eCalluu00UJk akDpPrzNwtXmyidXdAItXV/xRanMPmFoxzYDVS3JHrjvlVGZoCKfNT7SWzvasAU86MyJ Oxz12KtvsMzPV55rXLlomUQEgbpRPJX+MZqGkwLRkEHnQ0rIyWkxI1LyutcB0WkdiWLb bFfYrn1O0zaAsGd0qu72Z+x6haQq6gQwDIZGBc5+DXMyzBGbotjIfXpzZxq6Hlr/BRYK EUaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717622127; x=1718226927; 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=8p2HosDvmS098I1PRmfiW9ZIdsUwMQx7c58R0dSQai4=; b=PNTZPvjwpUk2AllTnpv2g/HS1rf1ZpZ2C+RhSLXpvFjmrKO6F/PtKzTsWMluElTP60 4Vr0zTpjyLANhQQmoRBnHkRH3vqlXbvRJqDkW3z/KJYTKQgdpI/FNBXc/n4oSmcePu18 PXd7tmWMeHdifc9J+MsnURfHfUZKhW4PPGpaZWB3DSNDs4uEVkyEuRQs6OcXmZMCnh1A dzb+fftNH2wyats7OD2NISSQyWXzTRw55evEDQYV4WewA5eZ1FrjpSmqpat5BLadYYdy PtXI0AfLMr4BXaIcmYPy3pG6PeDlVKjS0xw7NdzmwS23Tgzk5aVUCHoJLTiEdcwJ2++R HnJw== X-Gm-Message-State: AOJu0YycHwauV5dcXGkJ2P8vuS0ve419Ht7xPnUUW4fap0cGLVQq7zWq TGm67lvOe4euRDMiFvXQr3ORUbhR+jbXVZQEDokKEWttk6qQxHNQXwbjuBLIr1l/Q+YBlwZAFmW l X-Received: by 2002:a05:6a20:a122:b0:1af:d19b:a76 with SMTP id adf61e73a8af0-1b2b6e2a28fmr4536166637.12.1717622127326; Wed, 05 Jun 2024 14:15:27 -0700 (PDT) Received: from stoup.. ([71.212.132.216]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70242aec7d0sm9347538b3a.99.2024.06.05.14.15.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:15:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 05/16] system/qtest: Replace sprintf by qemu_hexdump_line Date: Wed, 5 Jun 2024 14:15:10 -0700 Message-Id: <20240605211521.577094-6-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 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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+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é ` [rth: Use qemu_hexdump_line] Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20240412073346.458116-8-richard.henderson@linaro.org> --- system/qtest.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/system/qtest.c b/system/qtest.c index 6da58b3874..507a358f3b 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -601,9 +601,9 @@ static void qtest_process_command(CharBackend *chr, gchar **words) qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%016" PRIx64 "\n", value); } else if (strcmp(words[0], "read") == 0) { - uint64_t addr, len, i; + g_autoptr(GString) enc = NULL; + uint64_t addr, len; uint8_t *data; - char *enc; int ret; g_assert(words[1] && words[2]); @@ -618,16 +618,12 @@ static void qtest_process_command(CharBackend *chr, gchar **words) address_space_read(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, data, len); - enc = g_malloc(2 * len + 1); - for (i = 0; i < len; i++) { - sprintf(&enc[i * 2], "%02x", data[i]); - } + enc = qemu_hexdump_line(NULL, data, len, 0, 0); qtest_send_prefix(chr); - qtest_sendf(chr, "OK 0x%s\n", enc); + qtest_sendf(chr, "OK 0x%s\n", enc->str); g_free(data); - g_free(enc); } else if (strcmp(words[0], "b64read") == 0) { uint64_t addr, len; uint8_t *data;