diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-22 10:03:15 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-22 10:03:15 +0000 |
commit | a5079576ae9007fb1ca7ebcc911b5fb035cd2d06 (patch) | |
tree | 70f4014dd37d780dfb45182d26092cb1998d4eec /src/libstddjb | |
parent | 49d8fa1058aaf23c29e074b2314492ae40d2f557 (diff) | |
download | skalibs-a5079576ae9007fb1ca7ebcc911b5fb035cd2d06.tar.xz |
Types change: switch libdatastruct to uint32_t
Still needs to be reviewed.
Diffstat (limited to 'src/libstddjb')
-rw-r--r-- | src/libstddjb/alloc.c | 4 | ||||
-rw-r--r-- | src/libstddjb/allreadwrite.c | 2 | ||||
-rw-r--r-- | src/libstddjb/bitarray_and.c | 5 | ||||
-rw-r--r-- | src/libstddjb/bitarray_clearsetn.c | 8 | ||||
-rw-r--r-- | src/libstddjb/bitarray_count.c | 2 | ||||
-rw-r--r-- | src/libstddjb/bitarray_firstclear.c | 4 | ||||
-rw-r--r-- | src/libstddjb/bitarray_firstset.c | 4 | ||||
-rw-r--r-- | src/libstddjb/bitarray_not.c | 4 | ||||
-rw-r--r-- | src/libstddjb/bitarray_or.c | 5 | ||||
-rw-r--r-- | src/libstddjb/bitarray_testandpoke.c | 6 | ||||
-rw-r--r-- | src/libstddjb/bitarray_xor.c | 5 | ||||
-rw-r--r-- | src/libstddjb/bufalloc_clean.c | 2 | ||||
-rw-r--r-- | src/libstddjb/buffer_get.c | 4 | ||||
-rw-r--r-- | src/libstddjb/buffer_getvall.c | 2 | ||||
-rw-r--r-- | src/libstddjb/byte_chr.c | 2 | ||||
-rw-r--r-- | src/libstddjb/case_str.c | 2 | ||||
-rw-r--r-- | src/libstddjb/iobufferk_finish.c | 4 | ||||
-rw-r--r-- | src/libstddjb/iobufferu_init.c | 2 | ||||
-rw-r--r-- | src/libstddjb/ip4_scanu32.c | 2 | ||||
-rw-r--r-- | src/libstddjb/open3.c | 2 | ||||
-rw-r--r-- | src/libstddjb/time_from_tai.c | 2 |
21 files changed, 35 insertions, 38 deletions
diff --git a/src/libstddjb/alloc.c b/src/libstddjb/alloc.c index bf291f0..9c29cea 100644 --- a/src/libstddjb/alloc.c +++ b/src/libstddjb/alloc.c @@ -16,7 +16,7 @@ aligned_char *alloc (size_t n) { - register aligned_char *p = n ? (aligned_char *)malloc(n) : (aligned_char *)alloc_0 ; + aligned_char *p = n ? (aligned_char *)malloc(n) : (aligned_char *)alloc_0 ; #ifdef DEBUG_ALLOC static unsigned int counter = 0 ; PLM("alloc(%u): %p. Allocated: %u", n, p, ++counter) ; @@ -26,7 +26,7 @@ aligned_char *alloc (size_t n) void alloc_free (void *p) { - register int e = errno ; + int e = errno ; #ifdef DEBUG_ALLOC static unsigned int counter = 0 ; PLM("alloc_free(%p). Freed: %u", p, ++counter) ; diff --git a/src/libstddjb/allreadwrite.c b/src/libstddjb/allreadwrite.c index 0e22a8d..2eaae12 100644 --- a/src/libstddjb/allreadwrite.c +++ b/src/libstddjb/allreadwrite.c @@ -10,7 +10,7 @@ size_t allreadwrite (iofunc_t_ref op, int fd, char *buf, size_t len) size_t written = 0 ; while (len) { - register ssize_t w = (*op)(fd, buf, len) ; + ssize_t w = (*op)(fd, buf, len) ; if (w <= 0) { if (!w) errno = 0 ; diff --git a/src/libstddjb/bitarray_and.c b/src/libstddjb/bitarray_and.c index 449f300..1677988 100644 --- a/src/libstddjb/bitarray_and.c +++ b/src/libstddjb/bitarray_and.c @@ -5,7 +5,6 @@ void bitarray_and (unsigned char *c, unsigned char const *a, unsigned char const *b, size_t n) { - size_t len = bitarray_div8(n) ; - register size_t i = 0 ; - for (; i < len ; i++) c[i] = a[i] & b[i] ; + size_t i = bitarray_div8(n) ; + while (i--) c[i] = a[i] & b[i] ; } diff --git a/src/libstddjb/bitarray_clearsetn.c b/src/libstddjb/bitarray_clearsetn.c index 82bff7e..42900ad 100644 --- a/src/libstddjb/bitarray_clearsetn.c +++ b/src/libstddjb/bitarray_clearsetn.c @@ -3,19 +3,19 @@ #include <sys/types.h> #include <skalibs/bitarray.h> -void bitarray_clearsetn (register unsigned char *s, register size_t a, register size_t b, register int h) +void bitarray_clearsetn (unsigned char *s, size_t a, size_t b, int h) { if (!b) return ; b += a ; if ((a >> 3) == ((b-1) >> 3)) { - register unsigned char mask = (1 << (a & 7)) - 1 ^ (1 << 1 + (b-1 & 7)) - 1 ; + unsigned char mask = (1 << (a & 7)) - 1 ^ (1 << 1 + (b-1 & 7)) - 1 ; if (h) s[a>>3] |= mask ; else s[a>>3] &= ~mask ; } else { - register unsigned char mask = ~((1 << (a & 7)) - 1) ; - register size_t i = (a>>3) + 1 ; + unsigned char mask = ~((1 << (a & 7)) - 1) ; + size_t i = (a>>3) + 1 ; if (h) s[a>>3] |= mask ; else s[a>>3] &= ~mask ; mask = h ? 0xff : 0x00 ; for (; i < b>>3 ; i++) s[i] = mask ; diff --git a/src/libstddjb/bitarray_count.c b/src/libstddjb/bitarray_count.c index 47dfda7..8f4ab50 100644 --- a/src/libstddjb/bitarray_count.c +++ b/src/libstddjb/bitarray_count.c @@ -14,7 +14,7 @@ uint64_t bitarray_countones (unsigned char const *c, size_t n) static unsigned char const table[256] = { B3(0) } ; size_t len = bitarray_div8(n) ; uint64_t total = 0 ; - register size_t i = 0 ; + size_t i = 0 ; if (n & 7) len-- ; for (; i < len ; i++) total += table[c[i]] ; if (n & 7) total += table[c[i] & ((1 << (n & 7)) - 1)] ; diff --git a/src/libstddjb/bitarray_firstclear.c b/src/libstddjb/bitarray_firstclear.c index 869dffe..07dc964 100644 --- a/src/libstddjb/bitarray_firstclear.c +++ b/src/libstddjb/bitarray_firstclear.c @@ -3,10 +3,10 @@ #include <sys/types.h> #include <skalibs/bitarray.h> -size_t bitarray_firstclear (register unsigned char const *s, size_t max) +size_t bitarray_firstclear (unsigned char const *s, size_t max) { size_t n = bitarray_div8(max) ; - register size_t i = 0 ; + size_t i = 0 ; for (; i < n ; i++) if (s[i] != 0xffU) break ; if (i == n) return max ; i <<= 3 ; diff --git a/src/libstddjb/bitarray_firstset.c b/src/libstddjb/bitarray_firstset.c index 1422111..b3acd73 100644 --- a/src/libstddjb/bitarray_firstset.c +++ b/src/libstddjb/bitarray_firstset.c @@ -3,10 +3,10 @@ #include <sys/types.h> #include <skalibs/bitarray.h> -size_t bitarray_firstset (register unsigned char const *s, size_t max) +size_t bitarray_firstset (unsigned char const *s, size_t max) { size_t n = bitarray_div8(max) ; - register size_t i = 0 ; + size_t i = 0 ; for (; i < n ; i++) if (s[i]) break ; if (i == n) return max ; i <<= 3 ; diff --git a/src/libstddjb/bitarray_not.c b/src/libstddjb/bitarray_not.c index 06da25a..b3f614d 100644 --- a/src/libstddjb/bitarray_not.c +++ b/src/libstddjb/bitarray_not.c @@ -3,7 +3,7 @@ #include <sys/types.h> #include <skalibs/bitarray.h> -void bitarray_not (register unsigned char *s, register size_t a, register size_t b) +void bitarray_not (unsigned char *s, size_t a, size_t b) { if (!b) return ; b += a ; @@ -11,7 +11,7 @@ void bitarray_not (register unsigned char *s, register size_t a, register size_t s[a>>3] ^= ((1 << (a & 7)) - 1) ^ ((a << (b & 7)) - 1) ; else { - register size_t i = (a>>3) + 1 ; + size_t i = (a>>3) + 1 ; s[a>>3] ^= ~((1 << (a & 7)) - 1) ; for (; i < (b>>3) ; i++) s[i] = ~s[i] ; s[b>>3] ^= (1 << (b & 7)) - 1 ; diff --git a/src/libstddjb/bitarray_or.c b/src/libstddjb/bitarray_or.c index 1220ed2..8cc8d58 100644 --- a/src/libstddjb/bitarray_or.c +++ b/src/libstddjb/bitarray_or.c @@ -5,7 +5,6 @@ void bitarray_or (unsigned char *c, unsigned char const *a, unsigned char const *b, size_t n) { - size_t len = bitarray_div8(n) ; - register size_t i = 0 ; - for (; i < len ; i++) c[i] = a[i] | b[i] ; + size_t i = bitarray_div8(n) ; + while (i--) c[i] = a[i] | b[i] ; } diff --git a/src/libstddjb/bitarray_testandpoke.c b/src/libstddjb/bitarray_testandpoke.c index 5b13b7a..f12653a 100644 --- a/src/libstddjb/bitarray_testandpoke.c +++ b/src/libstddjb/bitarray_testandpoke.c @@ -3,10 +3,10 @@ #include <sys/types.h> #include <skalibs/bitarray.h> -int bitarray_testandpoke (register unsigned char *s, register size_t n, register int h) +int bitarray_testandpoke (unsigned char *s, size_t n, int h) { - register unsigned char mask = 1 << (n & 7) ; - register unsigned char c = s[n>>3] ; + unsigned char mask = 1 << (n & 7) ; + unsigned char c = s[n>>3] ; s[n>>3] = h ? c | mask : c & ~mask ; return (c & mask) ? 1 : 0 ; } diff --git a/src/libstddjb/bitarray_xor.c b/src/libstddjb/bitarray_xor.c index dde5dc7..ea59f0c 100644 --- a/src/libstddjb/bitarray_xor.c +++ b/src/libstddjb/bitarray_xor.c @@ -5,7 +5,6 @@ void bitarray_xor (unsigned char *c, unsigned char const *a, unsigned char const *b, size_t n) { - size_t len = bitarray_div8(n) ; - register size_t i = 0 ; - for (; i < len ; i++) c[i] = a[i] ^ b[i] ; + size_t i = bitarray_div8(n) ; + while (i--) c[i] = a[i] ^ b[i] ; } diff --git a/src/libstddjb/bufalloc_clean.c b/src/libstddjb/bufalloc_clean.c index 2b78f39..467d524 100644 --- a/src/libstddjb/bufalloc_clean.c +++ b/src/libstddjb/bufalloc_clean.c @@ -3,7 +3,7 @@ #include <string.h> #include <skalibs/bufalloc.h> -void bufalloc_clean (register bufalloc *ba) +void bufalloc_clean (bufalloc *ba) { if (ba->p) { diff --git a/src/libstddjb/buffer_get.c b/src/libstddjb/buffer_get.c index 0263f87..0d689ef 100644 --- a/src/libstddjb/buffer_get.c +++ b/src/libstddjb/buffer_get.c @@ -7,7 +7,7 @@ ssize_t buffer_get (buffer *b, char *s, size_t len) { size_t w = 0 ; - register int r = buffer_getall(b, s, len, &w) ; + int r = buffer_getall(b, s, len, &w) ; return r == -1 ? errno == EPIPE ? (errno = 0, (ssize_t)w) : -1 : - !r ? (errno = EWOULDBLOCK, -1) : (ssize_t)w ; + !r ? (errno = EWOULDBLOCK, -1) : w ; } diff --git a/src/libstddjb/buffer_getvall.c b/src/libstddjb/buffer_getvall.c index 3a90871..a58f914 100644 --- a/src/libstddjb/buffer_getvall.c +++ b/src/libstddjb/buffer_getvall.c @@ -12,7 +12,7 @@ int buffer_getvall (buffer *b, struct iovec const *v, unsigned int n, size_t *wr struct iovec vv[n ? n : 1] ; if (*written > len) return (errno = EINVAL, -1) ; { - register unsigned int i = n ; + unsigned int i = n ; while (i--) vv[i] = v[i] ; } siovec_seek(vv, n, *written) ; diff --git a/src/libstddjb/byte_chr.c b/src/libstddjb/byte_chr.c index d24e92d..bf0cf52 100644 --- a/src/libstddjb/byte_chr.c +++ b/src/libstddjb/byte_chr.c @@ -6,6 +6,6 @@ size_t byte_chr (char const *s, size_t n, int c) { - register void *p = memchr(s, c, n) ; + void *p = memchr(s, c, n) ; return p ? (char *)p - s : n ; } diff --git a/src/libstddjb/case_str.c b/src/libstddjb/case_str.c index 9c79019..59f157f 100644 --- a/src/libstddjb/case_str.c +++ b/src/libstddjb/case_str.c @@ -10,7 +10,7 @@ size_t case_str (char const *haystack, char const *needle) { - register char *p = strcasestr(haystack, needle) ; + char *p = strcasestr(haystack, needle) ; return p ? p - haystack : strlen(haystack) ; } diff --git a/src/libstddjb/iobufferk_finish.c b/src/libstddjb/iobufferk_finish.c index f743328..112174b 100644 --- a/src/libstddjb/iobufferk_finish.c +++ b/src/libstddjb/iobufferk_finish.c @@ -15,14 +15,14 @@ static void iobufferk_nop (iobufferk *k) static void iobufferk_finish_0 (iobufferk *k) { - register int e = errno ; + int e = errno ; fd_close(k->p[1]) ; errno = e ; } static void iobufferk_finish_3 (iobufferk *k) { - register int e = errno ; + int e = errno ; fd_close(k->p[1]) ; fd_close(k->p[0]) ; errno = e ; diff --git a/src/libstddjb/iobufferu_init.c b/src/libstddjb/iobufferu_init.c index b9d643b..affd01b 100644 --- a/src/libstddjb/iobufferu_init.c +++ b/src/libstddjb/iobufferu_init.c @@ -7,7 +7,7 @@ int iobufferu_init (iobufferu *b, int fdin, int fdout) { - register char *x = alloc(IOBUFFERU_SIZE) ; + char *x = alloc(IOBUFFERU_SIZE) ; if (!x) return 0 ; b->buf = x ; buffer_init(&b->b[0], &fd_readv, fdin, x, IOBUFFERU_SIZE) ; diff --git a/src/libstddjb/ip4_scanu32.c b/src/libstddjb/ip4_scanu32.c index 205c52d..ab51ad6 100644 --- a/src/libstddjb/ip4_scanu32.c +++ b/src/libstddjb/ip4_scanu32.c @@ -8,7 +8,7 @@ size_t ip4_scanu32 (char const *s, uint32_t *ip) { char pack[4] ; - register size_t r = ip4_scan(s, pack) ; + size_t r = ip4_scan(s, pack) ; if (r) uint32_unpack_big(pack, ip) ; return r ; } diff --git a/src/libstddjb/open3.c b/src/libstddjb/open3.c index f52b8cd..21fd904 100644 --- a/src/libstddjb/open3.c +++ b/src/libstddjb/open3.c @@ -7,7 +7,7 @@ int open3 (char const *s, unsigned int flags, unsigned int mode) { - register int r ; + int r ; do r = open(s, flags, mode) ; while ((r == -1) && (errno == EINTR)) ; return r ; diff --git a/src/libstddjb/time_from_tai.c b/src/libstddjb/time_from_tai.c index 406fcfb..1f4ff2a 100644 --- a/src/libstddjb/time_from_tai.c +++ b/src/libstddjb/time_from_tai.c @@ -13,7 +13,7 @@ int time_from_tai (time_t *u, tai_t const *t) { - register uint64_t uu = t->x - TAI_MAGIC ; + uint64_t uu = t->x - TAI_MAGIC ; #if SKALIBS_SIZEOFTIME < 8 if ((uu >> 32) && (uu >> 32) != 0xffffffffUL) return (errno = EOVERFLOW, 0) ; |