From 7eede3b4688e37f48c0cb29598111f47bc8a8a4d Mon Sep 17 00:00:00 2001 From: acevest Date: Sat, 15 Aug 2026 08:42:14 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E8=BE=93=E5=87=BA=E6=A0=BC?= =?utf8?q?=E5=BC=8F=E8=BD=AC=E6=8D=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/string.c | 5 +++-- lib/vsprintf.c | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/string.c b/lib/string.c index c7ca91c..d1cc161 100644 --- a/lib/string.c +++ b/lib/string.c @@ -88,11 +88,12 @@ char* strcat(char* dest, const char* src) { // ; while (1) { *dest = *src; - dest++; - src++; if (*dest == 0) { break; } + + dest++; + src++; } return tmp; } diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 1129c0a..2150486 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -169,17 +169,19 @@ char* i64tou(char* s, uint64_t n) { char* itou(char* s, unsigned int n) { char* p = s; + char* h = s; do { *p++ = (n % 10) + '0'; n /= 10; } while (n); - *p-- = 0; + *p = 0; + p--; - while (s < p) { - swap_char(s, p); - s++; + while (h < p) { + swap_char(h, p); + h++; p--; } return s; -- 2.47.0