From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69D95428850 for ; Fri, 6 Feb 2026 19:11:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770405092; cv=none; b=O0iaLPq5HNpPWvYNauj8kyhS7XNteBxYGCh2Y4a7PsCubibGpXf3/YKXkju8LdIIfzxeXDQTnzhtAbWyhSeNXDuRvP3Y51aERI9sHrW8HzrWi6HNVwcMgGkqAk1JYmgl5Oasi51XEPyFTQo5tSpMu6px7YZfJY2NnB7aVCSdu3g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770405092; c=relaxed/simple; bh=I6UtICNbpv9IBSR+paTDdJuOGRzVnHTrmAp9aK+QpeM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qnL/P10oxSwGsYXwwh2Hjf4s2aT7sAhL+mi483u67kzyIp0KiA9bq0AOr+25449+0ee1F56d8y6dL45dyNp059r/jdmOg72U1SSNcaQ16lz06hrlwndMDgxaneOaQNbkUqgLa6AtmGWKotd9DYR8+kPdCQJV4OwCHJ2OOQQM8Lo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lFctH9Va; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lFctH9Va" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-4359a16a400so2379993f8f.1 for ; Fri, 06 Feb 2026 11:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770405091; x=1771009891; darn=vger.kernel.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=vuBDo30Rf2J2nH/Q/nsopyNvKAj8z57Dbw32n9bpR5E=; b=lFctH9VaEWINfrFvmFDfol5UGwzI3DrFq33z7b4YUHMDtaI2eMQMzV6aQYuTuJzkB9 M4F5c63U8TztJ5sAOPUpVA7bSXEMmgiZdTwvzJYgzC70y4OX71gaBzGEm3RQEjbJueja c/cC/qD2N2+E4fQGif2YqzPRByO74d/BIb/5puxFlyzspZGFGpNgr0bzvF89tYMOHaWT l77Zfx9xnCJi7BOJaeVvVntQ2hP7+puTtMjW/SxZiNvgctFVCxtSM0HbOuGl7+S3IrYx vcKziE3lDoj/X8Z61FF/CxAfUNUdIaAXpBCM9fPKfKnQHBQ7IKTmQBB/R6fsMCiZmhs0 aP2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770405091; x=1771009891; 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=vuBDo30Rf2J2nH/Q/nsopyNvKAj8z57Dbw32n9bpR5E=; b=qcGWy/++4FI5q2z3Nw3qyFJlyF0+adQuFHLLqDgObN5SkiSyP5SNAiZLRlyzTR2Rzy cQXz5ju1UEX85funpSZADFJkoxu+iSJT+nOjh1IYJvVqi44YlRxyPfk0DZNjGwIi19GR QkukNq4xxQc/kR8sroxzC+IuthPR3hcZsXqyTv9jdwN3wzVlPYOkeEtycBMUNSrrdACV QltK7TDyASEjLQfcZcAmN99+wqH+Z96NiLTsjCiqSPYAuxZSKDEKhOplR9T/2qN7iuxu /31wISuTPo+1WpApIQINij8M9GBayq+xm4NN2rhoAhyyTCg9C2I47KagK6QHmOj1zyrc EfLA== X-Forwarded-Encrypted: i=1; AJvYcCXAGhg1m28CgkebWaiqXkuDuWWQaEQcTx4Lw+diuBX4dlLq9EBLtg9eeQ4ttz/bsSuEFDqk2+qxHSOUXSc=@vger.kernel.org X-Gm-Message-State: AOJu0Yyc+mLf2UUao531dHB7yBvgFeK8iWli0Z4Xqe6zta+8xTPRS3TE m5Cu388iOIp1tewYkn4IcEC+y1yz4qIHaVRTYmI838Bons89L1y2uUwq X-Gm-Gg: AZuq6aJ6IzcOMy6uB/Qb0WAYfSYTdpFAFBT/p9vzdbf4EQ3QsF1sMcuUVkRhp/Jix8p eoYod96gi+iFSKvc1HJJy7LSied7rapiifVFegG1BDh/boNIwMtSiNmeq2O7J7FHmAVRcij3rM9 tJuI41UZ6ajrAUCqe/vFB7Chm2LjhpsANsJaAtXChhbmUdIJQ+IJPDHwE+FXol6Fsj13osGMGRt BECM+PdZ8QdG/WKg8fq1F7i7c4DK2pfXMMJNeQFjAdvmiLyPy1j63iAIdhfT8lsqwUn8Y7Kvdpn wM+jwRd81MLI6Kl8MktderOCelzVrTvui/DdBp2QF5YTiGMkLUvMBszr1x3ZrzgetvgqHSkl74A VGFSLaOrOfgndHVCu8Bc4dMxRvO68P1zc7jCD2Km/+xglmSbTQfxMiWERaWpp1vN14nEgjRV9FV NzVOvRh+/AuyWk3U7f/z6a6jI1c961wazbmbI26yYyjp5L4sgTaHysx5cd7WpWNxSq4g60tBa2 X-Received: by 2002:a05:6000:24c9:b0:432:5b81:483 with SMTP id ffacd0b85a97d-436293413ccmr6266925f8f.24.1770405090673; Fri, 06 Feb 2026 11:11:30 -0800 (PST) Received: from snowdrop.snailnet.com (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4362972fb81sm8703681f8f.20.2026.02.06.11.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 11:11:30 -0800 (PST) From: david.laight.linux@gmail.com To: Willy Tarreau , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , linux-kernel@vger.kernel.org, Cheng Li Cc: David Laight Subject: [PATCH v2 next 01/11] tools/nolibc/printf: Change variable used for format chars from 'c' to 'ch' Date: Fri, 6 Feb 2026 19:11:11 +0000 Message-Id: <20260206191121.3602-2-david.laight.linux@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260206191121.3602-1-david.laight.linux@gmail.com> References: <20260206191121.3602-1-david.laight.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: David Laight This makes the code slightly easier to read because the variable stands out from the single character literals (especially 'c'). The following patches pretty much rewrite the function so the churn is limited. Signed-off-by: David Laight --- New patch for v2. tools/include/nolibc/stdio.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h index 1f16dab2ac88..f162cc697a73 100644 --- a/tools/include/nolibc/stdio.h +++ b/tools/include/nolibc/stdio.h @@ -250,7 +250,7 @@ typedef int (*__nolibc_printf_cb)(intptr_t state, const char *buf, size_t size); static __attribute__((unused, format(printf, 4, 0))) int __nolibc_printf(__nolibc_printf_cb cb, intptr_t state, size_t n, const char *fmt, va_list args) { - char escape, lpref, c; + char escape, lpref, ch; unsigned long long v; unsigned int written, width; size_t len, ofs, w; @@ -259,7 +259,7 @@ int __nolibc_printf(__nolibc_printf_cb cb, intptr_t state, size_t n, const char written = ofs = escape = lpref = 0; while (1) { - c = fmt[ofs++]; + ch = fmt[ofs++]; width = 0; if (escape) { @@ -267,17 +267,17 @@ int __nolibc_printf(__nolibc_printf_cb cb, intptr_t state, size_t n, const char escape = 0; /* width */ - while (c >= '0' && c <= '9') { + while (ch >= '0' && ch <= '9') { width *= 10; - width += c - '0'; + width += ch - '0'; - c = fmt[ofs++]; + ch = fmt[ofs++]; } - if (c == 'c' || c == 'd' || c == 'u' || c == 'x' || c == 'p') { + if (ch == 'c' || ch == 'd' || ch == 'u' || ch == 'x' || ch == 'p') { char *out = tmpbuf; - if (c == 'p') + if (ch == 'p') v = va_arg(args, unsigned long); else if (lpref) { if (lpref > 1) @@ -287,7 +287,7 @@ int __nolibc_printf(__nolibc_printf_cb cb, intptr_t state, size_t n, const char } else v = va_arg(args, unsigned int); - if (c == 'd') { + if (ch == 'd') { /* sign-extend the value */ if (lpref == 0) v = (long long)(int)v; @@ -295,7 +295,7 @@ int __nolibc_printf(__nolibc_printf_cb cb, intptr_t state, size_t n, const char v = (long long)(long)v; } - switch (c) { + switch (ch) { case 'c': out[0] = v; out[1] = 0; @@ -316,28 +316,28 @@ int __nolibc_printf(__nolibc_printf_cb cb, intptr_t state, size_t n, const char } outstr = tmpbuf; } - else if (c == 's') { + else if (ch == 's') { outstr = va_arg(args, char *); if (!outstr) outstr="(null)"; } - else if (c == 'm') { + else if (ch == 'm') { #ifdef NOLIBC_IGNORE_ERRNO outstr = "unknown error"; #else outstr = strerror(errno); #endif /* NOLIBC_IGNORE_ERRNO */ } - else if (c == '%') { + else if (ch == '%') { /* queue it verbatim */ continue; } else { /* modifiers or final 0 */ - if (c == 'l') { + if (ch == 'l') { /* long format prefix, maintain the escape */ lpref++; - } else if (c == 'j') { + } else if (ch == 'j') { lpref = 2; } escape = 1; @@ -348,7 +348,7 @@ int __nolibc_printf(__nolibc_printf_cb cb, intptr_t state, size_t n, const char } /* not an escape sequence */ - if (c == 0 || c == '%') { + if (ch == 0 || ch == '%') { /* flush pending data on escape or end */ escape = 1; lpref = 0; @@ -369,7 +369,7 @@ int __nolibc_printf(__nolibc_printf_cb cb, intptr_t state, size_t n, const char written += len; do_escape: - if (c == 0) + if (ch == 0) break; fmt += ofs; ofs = 0; -- 2.39.5