From 47d2c0177c285ac6fcf0458b3ef10e63e43dedb2 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Tue, 21 Nov 2023 16:45:45 +0100 Subject: steprl: use do..while --- steprl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/steprl.c b/steprl.c index 5c14a23..d1ae3b9 100644 --- a/steprl.c +++ b/steprl.c @@ -14,10 +14,11 @@ steprl(char *dst, char *end, long n) if (neg) n = -n; - if (!n) - *--s = '0'; - for (; n > 0; n /= 10) - *--s = '0' + (n%10); + do { + *--s = '0' + (n % 10); + n /= 10; + } while (n > 0); + if (neg) *--s = '-'; -- cgit 1.4.1