summaryrefslogtreecommitdiff
path: root/split.c
diff options
context:
space:
mode:
Diffstat (limited to 'split.c')
-rw-r--r--split.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/split.c b/split.c
index 81671a7..a3d0e77 100644
--- a/split.c
+++ b/split.c
@@ -39,13 +39,14 @@ static char *nextsuffix(size_t n, char s[])
return s;
}
- for (size_t i = n - 1; ; i--) {
- s[i] = *(strchr(alphabet, s[i]) + 1);
- if (s[i] == '\0') {
- if (i == 0) {
+ n--;
+ for (;;) {
+ s[n] = *(strchr(alphabet, s[n]) + 1);
+ if (s[n] == '\0') {
+ if (n == 0) {
return NULL;
}
- s[i] = alphabet[0];
+ s[n--] = alphabet[0];
} else {
break;
}