diff options
author | Leah Neukirchen <leah@vuxu.org> | 2023-11-21 16:45:45 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2023-11-21 16:45:45 +0100 |
commit | 858c2bff541b09f345343c673c6c9d262b897f4f (patch) | |
tree | 6fb41fbbcb9f8ba0dcdf7e6351060df285340ad4 | |
parent | b2e38120bb02572cc395dcca6f2c7b10da100f78 (diff) | |
download | libste-858c2bff541b09f345343c673c6c9d262b897f4f.tar.gz libste-858c2bff541b09f345343c673c6c9d262b897f4f.tar.xz libste-858c2bff541b09f345343c673c6c9d262b897f4f.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 = '-'; |