diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-07 21:43:42 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-07 21:43:42 +0000 |
commit | 1ddf95240c77ae0786dd29e14acdf3549be9094c (patch) | |
tree | ebff87b299cb9fec7a841c03ac13e54a9f165952 /src/skaembutils/s6-sort.c | |
parent | 1a5f11e0cf9e5287a50f032838e787c38003a1a4 (diff) | |
download | s6-portable-utils-1ddf95240c77ae0786dd29e14acdf3549be9094c.tar.xz |
Types fix: first pass
Preparation for the skalibs size_t API change.
Diffstat (limited to 'src/skaembutils/s6-sort.c')
-rw-r--r-- | src/skaembutils/s6-sort.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/skaembutils/s6-sort.c b/src/skaembutils/s6-sort.c index afac913..ec22e0d 100644 --- a/src/skaembutils/s6-sort.c +++ b/src/skaembutils/s6-sort.c @@ -25,7 +25,7 @@ static int flagnoblanks = 0, flagreverse = 0, flaguniq = 0 ; static strncmp_t_ref comp = &strncmp ; -static int compit (register char const *s1, register unsigned int n1, register char const *s2, register unsigned int n2) +static int compit (register char const *s1, register size_t n1, register char const *s2, register size_t n2) { register int r ; if (flagnoblanks) @@ -43,9 +43,9 @@ static int sacmp (stralloc const *a, stralloc const *b) return compit(a->s, a->len - 1, b->s, b->len - 1) ; } -static int slurplines (genalloc *lines, char sep) +static ssize_t slurplines (genalloc *lines, char sep) { - unsigned int i = 0 ; + ssize_t i = 0 ; for (;; i++) { stralloc sa = STRALLOC_ZERO ; @@ -56,29 +56,29 @@ static int slurplines (genalloc *lines, char sep) stralloc_shrink(&sa) ; if (!genalloc_append(stralloc, lines, &sa)) return -1 ; } - return (int)i ; + return i ; } static void uniq (genalloc *lines) { - unsigned int len = genalloc_len(stralloc, lines) ; + size_t len = genalloc_len(stralloc, lines) ; register stralloc *s = genalloc_s(stralloc, lines) ; - register unsigned int i = 1 ; + register size_t i = 1 ; for (; i < len ; i++) if (!sacmp(s+i-1, s+i)) stralloc_free(s+i-1) ; } -static int outputlines (stralloc const *s, unsigned int len) +static ssize_t outputlines (stralloc const *s, size_t len) { - register unsigned int i = 0 ; + register size_t i = 0 ; for (; i < len ; i++) if (buffer_put(buffer_1, s[i].s, s[i].len) < 0) return 0 ; return buffer_flush(buffer_1) ; } -static int check (stralloc const *s, unsigned int len) +static int check (stralloc const *s, size_t len) { - register unsigned int i = 1 ; + register size_t i = 1 ; for (; i < len ; i++) if (sacmp(s+i-1, s+i) >= !flaguniq) return 0 ; return 1 ; |