diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-17 22:30:53 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-17 22:30:53 +0000 |
commit | fdffefb8032922ce7ffe4c00816072a8ff2148fc (patch) | |
tree | bc7313151a429c45d8bab8ad8b9dd32f4e51335f /src/libstddjb/envdir.c | |
parent | a896ca2a8c617e5e00ffd5fc9e69331ad754e5b3 (diff) | |
download | skalibs-fdffefb8032922ce7ffe4c00816072a8ff2148fc.tar.xz |
More types changes
New disize
Add size_t to the autotypes list
Delete redundant and replace-libc files
dev_t/ino_t pass
Big size_t pass
More things missing, still not operational yet
Diffstat (limited to 'src/libstddjb/envdir.c')
-rw-r--r-- | src/libstddjb/envdir.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/libstddjb/envdir.c b/src/libstddjb/envdir.c index 7866c7a..6992654 100644 --- a/src/libstddjb/envdir.c +++ b/src/libstddjb/envdir.c @@ -1,6 +1,7 @@ /* ISC license. */ #include <unistd.h> +#include <string.h> #include <errno.h> #include <skalibs/bytestr.h> #include <skalibs/env.h> @@ -14,8 +15,8 @@ int envdir_internal (char const *path, stralloc *modifs, unsigned int options, c { char buf[MAXVARSIZE + 1] ; unsigned int n = 0 ; - unsigned int pathlen = str_len(path) ; - unsigned int modifbase = modifs->len ; + size_t pathlen = strlen(path) ; + size_t modifbase = modifs->len ; int wasnull = !modifs->s ; DIR *dir ; if (!nullis) return (errno = EINVAL, -1) ; @@ -24,19 +25,19 @@ int envdir_internal (char const *path, stralloc *modifs, unsigned int options, c for (;;) { direntry *d ; - unsigned int len ; - register int r ; + size_t len ; + ssize_t r ; errno = 0 ; d = readdir(dir) ; if (!d) break ; if (d->d_name[0] == '.') continue ; - len = str_len(d->d_name) ; + len = strlen(d->d_name) ; if (str_chr(d->d_name, '=') < len) continue ; { char tmp[pathlen + len + 2] ; - byte_copy(tmp, pathlen, path) ; + memcpy(tmp, path, pathlen) ; tmp[pathlen] = '/' ; - byte_copy(tmp + pathlen + 1, len + 1, d->d_name) ; + memcpy(tmp + pathlen + 1, d->d_name, len + 1) ; r = openreadnclose(tmp, buf, MAXVARSIZE) ; } if (r < 0) @@ -60,8 +61,8 @@ int envdir_internal (char const *path, stralloc *modifs, unsigned int options, c } } { - register unsigned int i = 0 ; - for (; i < (unsigned int)r ; i++) if (!buf[i]) buf[i] = nullis ; + size_t i = 0 ; + for (; i < (size_t)r ; i++) if (!buf[i]) buf[i] = nullis ; } buf[r++] = 0 ; if (!env_addmodif(modifs, d->d_name, buf)) goto err ; @@ -75,7 +76,7 @@ int envdir_internal (char const *path, stralloc *modifs, unsigned int options, c err: { - register int e = errno ; + int e = errno ; dir_close(dir) ; if (wasnull) stralloc_free(modifs) ; else modifs->len = modifbase ; errno = e ; |