From patchwork Fri Apr 12 07:33:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 788259 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp590970wrm; Fri, 12 Apr 2024 00:36:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU7/K0xwpurI1zp0L3HAmkCSr1k7fXy8+F4CBOGMLiDbX63TDRpxOPqsbSWhtINY0Gte0+ExsyDX6KMwF50OfFm X-Google-Smtp-Source: AGHT+IGoCNGMpmB55YvaTbb3Z8g6nQ3rtl2YqCuYH/YrLVb1HZjj8UqmU9Rvj3FS/yT3sE/77Zvv X-Received: by 2002:a05:622a:1813:b0:434:583d:3776 with SMTP id t19-20020a05622a181300b00434583d3776mr2093470qtc.6.1712907364839; Fri, 12 Apr 2024 00:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712907364; cv=none; d=google.com; s=arc-20160816; b=ZmPne5GCHIsTGDc4oJ+N8jWD67cHU28ToYm08+uKih8Uk1/vzeqP691fvI6weftsA5 wQFbKsJ6vy37066SRVNADU24N6l/1fhwF8v4pAuYADl9VB0eO+TEE8QvBN15S0dcz9Sm Vx/H7svojjCYURYqFgeSQ5BsirMI4y2grP72luHDm6hjROuEVbiZalqqc66Zs1rgLJDR W+eEyJVna2/elyQNfh208cC60Pf2skG7KnhzkdrGHg1/Eyda7Dm3Z4kD6ZXWk2r2UNKp ZGy9YR2GpxAuQgD+Lu00fhKTkHl+/CxKBXq5NluuwUzx+y0LThdFIMh9YWMNRozCgcpp WyPw== 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=fnSXZctlzd8Wm3DUoANmQRZQ2vSrRZB+EmzfSv7sIGQ=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=GHaaV2tP4eTKGDgwZ3pUnYRr1EQB0qjLYdcHWOlTcmf8TgUihoi1gKefWXWkvf/3CV 5caQEu4FCDeD1lpZHsFszw1YLWTaNMDG5m0/o6KnN4yg0G8J2vWjQwi9hp+6ej7z03x4 AR1FxzQ6lS7s1Q7ahO6ZwB0SN0ke2k37MvZOV77JfgEK1qcCiz37Tvus67YN47VL7V0n pM4Y7LnU1qhION2fsdN6dw+KkEiNh22c1oBbYxE1wyW9nqSNaoiFSJF/xggTKn5y18pk qx1t6w5bUQvbrzXY508OdJ3FHLAIZG2TGUtMb8hTRubSF+jhkJN/0B0FFyH5D17ZfPyS tW4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jfS7hNKj; 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 d9-20020a05622a05c900b004366340b380si2826119qtb.270.2024.04.12.00.36.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Apr 2024 00:36:04 -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=jfS7hNKj; 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 1rvBQ6-000703-EV; Fri, 12 Apr 2024 03:33:58 -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 1rvBQ4-0006zD-Cz for qemu-devel@nongnu.org; Fri, 12 Apr 2024 03:33:56 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rvBQ2-00076y-QP for qemu-devel@nongnu.org; Fri, 12 Apr 2024 03:33:56 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1e50a04c317so3847065ad.1 for ; Fri, 12 Apr 2024 00:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712907233; x=1713512033; 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=fnSXZctlzd8Wm3DUoANmQRZQ2vSrRZB+EmzfSv7sIGQ=; b=jfS7hNKjWkfRCMcM1YDj6JhZgolCUtddi8g4hfJjyh3vwZpAhb6pqMfliCbFChFCz7 QJyeRsvFgutfHRhb8dJ8XuVFJw96SL/NMyBwSTTHD4yEzYmo9vCA1eWzuOzbXzIH5yxQ bnbYuJLzhEkkdfFUD8Flwh5T18sNGdMw7cnhXf/qDNEujPF65ks18vMwp4vh4oAlh/YS GfroGsNUqAaezoAYjClvZUN1RRSoGoFGF3aYJTBzHbN55ojbyWNA3QZBzg8AB3S3ndvd OQuzBDcub1Ln0gFvS1uuVDoJEl+bSWKon/cl3ZB93TI2pP8P6+zav6rSNZyoBIJjbRtL Ggfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712907233; x=1713512033; 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=fnSXZctlzd8Wm3DUoANmQRZQ2vSrRZB+EmzfSv7sIGQ=; b=I5DntoSogwyRd0sYc2E89v/P8D7pfMORlHHlJ4EKTcI73dFP+QgUR/LGmLO2BDWkbL fOU4jQEQ3nEctjrbr9T/YdEjjzDFLP/tmQdk48d50N/NE/xX6eQJPpBHQOH4lk14AbNW WpPDol4qPN5rLiLcKxHd17uY7ptJUqIVGAajFZ5ieRSO6WXyUzqlT2X3lsqg442ukl0o 2nGbv1Pki0EsbKjGX7N47p5Y8nlENviH60VWnEjPtHznWg2JG2SU2sJq+A0MY+8myRvC Vqhqbc5CbHZQoLBSRPMhjMJCuzZK67pVKO4d0BzVDQ4kmsAziBNyITUnaPWFI6TQND2L waIA== X-Gm-Message-State: AOJu0YxtGDSLRISbZ9YwPzOQXdb3ylipxQfV3DkLJHHW+iEqswBes7Rs RwiK4oyFNaUTcCOcTbEARQqdSc9a4CTUWbt7HGaRqeFfVJFOQLbml3Wz2o4EkmvBgWaffOpNL5S i X-Received: by 2002:a17:902:ea10:b0:1dd:135e:2604 with SMTP id s16-20020a170902ea1000b001dd135e2604mr1977494plg.40.1712907233310; Fri, 12 Apr 2024 00:33:53 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:33:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 07/27] system/qtest: Replace sprintf by qemu_hexdump_line Date: Fri, 12 Apr 2024 00:33:26 -0700 Message-Id: <20240412073346.458116-8-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::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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é ` [rth: Use qemu_hexdump_line] Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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;