diff options
author | Leah Neukirchen <leah@vuxu.org> | 2023-11-21 16:45:45 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2024-07-14 14:50:34 +0200 |
commit | 47d2c0177c285ac6fcf0458b3ef10e63e43dedb2 (patch) | |
tree | 1f6ce238b57130d1f64bbabee5332d5e8b483679 | |
parent | 5dabeb7e3c10f8b421ec19189b20bf19996194fa (diff) | |
download | libste-47d2c0177c285ac6fcf0458b3ef10e63e43dedb2.tar.gz libste-47d2c0177c285ac6fcf0458b3ef10e63e43dedb2.tar.xz libste-47d2c0177c285ac6fcf0458b3ef10e63e43dedb2.zip |
steprl: use do..while
-rw-r--r-- | steprl.c | 9 |
1 files 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 = '-'; |