From nobody Tue Feb 10 13:17:40 2026 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=1770119630; cv=none; d=zohomail.com; s=zohoarc; b=HEjoV+QUMTSpEx8Ivw7yZl1ZhQA+4HX7nam6bycwvuNJ7BJ5Vxwj/cQSzUkDC2XnRZuyWI/RaiOp+JJIFtaISdtmAgYxssqZCfXA0fsDjikS4FP5IzE/Lhc9guW5vArL0DZ/5noIgY5XDwBb0vSID8E7s/qG57zp0Y5B6NTIiVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770119630; 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=XSrliXOCATefwQIn64R/qg8IArPF/GMhbm/SYSQ7GEc=; b=Rg+U2AES+bK7K+9teDWoKmvIu6scixshhM3GGMtc7qBwR/lwbx3xSvM2Shw4pfqvdm/gaW9fEDbeTjNuSL1hWmTs0C5TmCtx37tcSH4lSQt8Q8+jt5X+ERSQyhXWM3fcgGjUhz0bCg/wddEbD588YSxbQnd1fe78psdPlrT9/M0= 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 17701196303704.3609163497569625; Tue, 3 Feb 2026 03:53:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vnExR-0008G3-1t; Tue, 03 Feb 2026 06:52:37 -0500 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 1vnEx3-0007wo-Cq for qemu-devel@nongnu.org; Tue, 03 Feb 2026 06:52:13 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vnEx0-00059T-8N for qemu-devel@nongnu.org; Tue, 03 Feb 2026 06:52:13 -0500 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-658cc45847cso8434269a12.0 for ; Tue, 03 Feb 2026 03:52:08 -0800 (PST) Received: from draig.lan ([185.124.0.126]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8dbf184e5dsm1040894866b.43.2026.02.03.03.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Feb 2026 03:52:07 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8407060072; Tue, 03 Feb 2026 11:52:02 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770119528; x=1770724328; 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=XSrliXOCATefwQIn64R/qg8IArPF/GMhbm/SYSQ7GEc=; b=tzrpDTIh4P5p9GJ5JX4dHf0q5vkIxo3w354uoJ9adIX/lh7vrDVxtP1Q6+hLcdaCpC 0IzVV8H1aNgUuBYAhydm97zeMqTzVwddrNQIKeT9RpsIOEPxOYW+lFuJJGSg+FqDHqdW n9VBIpQ0IHYV9T3K4Lk+NZ7pxi63j0z9KbFT+Xr1lUvRvxm08YACPszMNwAf/VL25C/S dUhgXWp0jfEMIkaa3zUelnJHmOK+Qz8bHbVx1Fno6Q8pgtX+drd/oIowrs0DbxcUJnTb sob6HsQ4NpjgYz0YgFjEF3mi6wICz0W3LI3YKKY8PV3Q3l6T3BzfCPkyKiEkZTmto1/b vJLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770119528; x=1770724328; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XSrliXOCATefwQIn64R/qg8IArPF/GMhbm/SYSQ7GEc=; b=OZh2/XdcuC24ag9M6z5rtuX7QvM/ma7LNIjfzp6LmAJYCeE7KXm9MCay+axBex6qs+ 8oAEAsuunqHHqDYmuMeFia9bRum7Hmi6rCo/kanwyzLm6iBz6MghLE/yDcMn/xVyzj+y V0fZ32G65/a919HBCmmhAE9fG/zS1KY0gItCJf67Do2XylD/S/4DyQBBbpKph1urhHzi +pEqVOQ7LyZIrFqglHYgyWufnsFQEzs2TnJwAUfFImBTediQdVkxjq+t+d205gtqg3eh sZfwOKsUMiUDcvcmBqoT+I7QAKX5jsRQB6KN2gD707a4nIXkH4Lg8aWd6nvzX9eDyHGm 7ROA== X-Gm-Message-State: AOJu0YzpZTZxl2IaIyVtv5YaxjSCQM7536YAoTUP7G6jLR0cnuO/nsfW X2O8pIzKgOuvkyM5l5fVKczL3y4TaVnq2lmYNjuQRLAgNpfFrxonG6uoEoCdMQGBl1Q= X-Gm-Gg: AZuq6aLazLHa0qh8SEW/HqT8x9njN4RtbIZqW9hPk0QJiKekpQZgBJOCp60Z1pbVmpv ZqSXh34AK1W2luQCbE8yqBFzMfqfEpQLE3T7ec3BhmtLlLnCjl4omcTHyXKVaoXgA53EoLVLWS9 JreWGORpPBTk90K0hzDvOvCJDMnu10lbEi1WJejK36kcM7h2kVSPm5C0Xsptm0sdGgH+WnSvwqM OT//hJjjiSUegocjxQgMKOJ+Pk0IoVvIdXY58SV9tOY7/xRUYfpiDmwKiQKajmJlZws28Rc4Nlv rr9RAGjRDUnIDxPUkaDauPYRRDJj40bdaj7ykmJkfaqz4YIiCLAdYbXDZWjJW9R9LheuRRludi0 bzq89l3OQnTuGlUjF3vlrZ9rWMB1ZfOiN03YLfjXlWdn9kbKhUbPAgRtqzMnk6ilZks7D3U7EwM QKUJ/MR7EUur57NADoUb/LRA== X-Received: by 2002:a17:907:70c:b0:b8a:fa35:989f with SMTP id a640c23a62f3a-b8dff696c1amr916446166b.38.1770119527895; Tue, 03 Feb 2026 03:52:07 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: John Snow , Pierrick Bouvier , qemu-arm@nongnu.org, Markus Armbruster , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Nicholas Piggin , Wainer dos Santos Moschetta , qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell , Cleber Rosa , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , "Edgar E. Iglesias" , qemu-s390x@nongnu.org, Thomas Huth , Paolo Bonzini , Akihiko Odaki , Daniel Henrique Barboza , David Hildenbrand , Ilya Leoshkevich , Richard Henderson , Laurent Vivier Subject: [PATCH 05/11] gdbstub/user: localise variables for reading gdb socket Date: Tue, 3 Feb 2026 11:51:55 +0000 Message-ID: <20260203115201.2387721-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260203115201.2387721-1-alex.bennee@linaro.org> References: <20260203115201.2387721-1-alex.bennee@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=2a00:1450:4864:20::536; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x536.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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: 1770119631550158500 Keep things tidy by moving the declarations to the block where they are used. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- gdbstub/user.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gdbstub/user.c b/gdbstub/user.c index cc71cda3e33..c7a3ef947ed 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -198,9 +198,6 @@ void gdb_qemu_exit(int code) int gdb_handlesig(CPUState *cpu, int sig, const char *reason, void *siginf= o, int siginfo_len) { - char buf[256]; - int n; - if (!gdbserver_state.init || gdbserver_user_state.fd < 0) { return sig; } @@ -246,11 +243,10 @@ int gdb_handlesig(CPUState *cpu, int sig, const char = *reason, void *siginfo, gdbserver_state.state =3D RS_IDLE; gdbserver_user_state.running_state =3D 0; while (gdbserver_user_state.running_state =3D=3D 0) { - n =3D read(gdbserver_user_state.fd, buf, 256); + char buf[256]; + int n =3D read(gdbserver_user_state.fd, buf, 256); if (n > 0) { - int i; - - for (i =3D 0; i < n; i++) { + for (int i =3D 0; i < n; i++) { gdb_read_byte(buf[i]); } } else { --=20 2.47.3