diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-21 12:05:07 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-21 12:05:07 +0000 |
commit | 49d8fa1058aaf23c29e074b2314492ae40d2f557 (patch) | |
tree | 393f884d5a99f984e992a0f35f1b02ac43536217 /src/libstddjb/envalloc_uniq.c | |
parent | fdffefb8032922ce7ffe4c00816072a8ff2148fc (diff) | |
download | skalibs-49d8fa1058aaf23c29e074b2314492ae40d2f557.tar.xz |
Types change: big pass on libstddjb and libunixonacid
libdatastruct still missing, library still not functional
Diffstat (limited to 'src/libstddjb/envalloc_uniq.c')
-rw-r--r-- | src/libstddjb/envalloc_uniq.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libstddjb/envalloc_uniq.c b/src/libstddjb/envalloc_uniq.c index 181128a..cf60b44 100644 --- a/src/libstddjb/envalloc_uniq.c +++ b/src/libstddjb/envalloc_uniq.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include <string.h> #include <errno.h> #include <skalibs/bytestr.h> #include <skalibs/genalloc.h> @@ -8,24 +9,24 @@ int envalloc_uniq (genalloc *v, char delim) { unsigned int m = 0 ; - register unsigned int i = 0 ; + size_t i = 0 ; for (; i < genalloc_len(char const *, v) ; i++) { - register unsigned int j = i+1 ; + size_t j = i+1 ; char const *s = genalloc_s(char const *, v)[i] ; - unsigned int n = str_chr(s, delim) ; + size_t n = str_chr(s, delim) ; if (delim && !s[n]) return (errno = EINVAL, -1) ; for (; j < genalloc_len(char const *, v) ; j++) { - register char const **p = genalloc_s(char const *, v) ; - if (!str_diffn(s, p[j], n)) + char const **p = genalloc_s(char const *, v) ; + if (!strncmp(s, p[j], n)) { - register unsigned int len = genalloc_len(char const *, v) - 1 ; + size_t len = genalloc_len(char const *, v) - 1 ; genalloc_setlen(char const *, v, len) ; p[j] = p[len] ; m++ ; } } } - return (int)m ; + return m ; } |