From 0d82edd9f8bebb396a9154d4e1003340dbf6b967 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 20 Dec 2014 12:34:14 +0000 Subject: Lots of cosmetic fixes. sha256 documented. --- src/libstddjb/alloc.c | 8 ++++---- src/libstddjb/alloc_0.c | 2 +- src/libstddjb/bufalloc_1.c | 3 +-- src/libstddjb/bufalloc_2.c | 3 +-- src/libstddjb/bufalloc_clean.c | 2 +- src/libstddjb/bufalloc_flush.c | 2 +- src/libstddjb/bufalloc_init.c | 2 +- src/libstddjb/buffer_getall.c | 2 +- src/libstddjb/buffer_getallnf.c | 2 +- src/libstddjb/buffer_getvallnf.c | 2 +- src/libstddjb/iobuffer_flush.c | 2 +- src/libstddjb/iobuffer_init.c | 2 +- src/libstddjb/iobuffer_kfromu.c | 4 ++-- src/libstddjb/iobuffer_salvage.c | 2 +- src/libstddjb/iobuffer_ufromk.c | 4 ++-- src/libstddjb/iobufferk_fill.c | 6 +++--- src/libstddjb/iobufferk_finish.c | 8 ++++---- src/libstddjb/iobufferk_init.c | 10 +++++----- src/libstddjb/iobufferk_isworking.c | 4 ++-- src/libstddjb/iobufferk_nosys.c | 2 +- src/libstddjb/iobufferu_fill.c | 2 +- src/libstddjb/iobufferu_finish.c | 2 +- src/libstddjb/ip46_scanlist.c | 2 +- src/libstddjb/localtmn_from_sysclock.c | 2 +- src/libstddjb/localtmn_from_tain.c | 2 +- src/libstddjb/localtmn_scan.c | 2 +- src/libstddjb/socket_local46.c | 2 +- src/libstddjb/socket_remote46.c | 2 +- src/libstddjb/subgetopt.c | 2 +- 29 files changed, 44 insertions(+), 46 deletions(-) (limited to 'src/libstddjb') diff --git a/src/libstddjb/alloc.c b/src/libstddjb/alloc.c index e3f89dd..31e3e05 100644 --- a/src/libstddjb/alloc.c +++ b/src/libstddjb/alloc.c @@ -13,9 +13,9 @@ # define PLM(...) (bprintf(buffer_2, "%s: debug_alloc: ", PROG), bprintf(buffer_2, __VA_ARGS__), buffer_putflush(buffer_2, "\n", 1)) #endif -aligned_char_ref alloc (unsigned int n) +aligned_char *alloc (unsigned int n) { - register aligned_char_ref p = n ? (aligned_char_ref)malloc(n) : (aligned_char_ref)alloc_0 ; + register 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) ; @@ -37,9 +37,9 @@ void alloc_free (void *p) errno = e ; } -int alloc_realloc (aligned_char_ref *x, unsigned int n) +int alloc_realloc (aligned_char **x, unsigned int n) { - aligned_char_ref y = n ? (aligned_char_ref)realloc(*x, n) : (free(*x), alloc_0) ; + aligned_char *y = n ? (aligned_char *)realloc(*x, n) : (free(*x), alloc_0) ; #ifdef DEBUG_ALLOC PLM("alloc_realloc(&%p) -> new address = %p", *x, y) ; #endif diff --git a/src/libstddjb/alloc_0.c b/src/libstddjb/alloc_0.c index 2175262..bdd42a4 100644 --- a/src/libstddjb/alloc_0.c +++ b/src/libstddjb/alloc_0.c @@ -8,6 +8,6 @@ #define ALIGNMENT 16 static union { unsigned char blah[ALIGNMENT] ; long double ld ; } const zeroblock ; -aligned_char_ref alloc_0 = (aligned_char_ref)(&zeroblock) ; +aligned_char *alloc_0 = (aligned_char_ref)(&zeroblock) ; #endif diff --git a/src/libstddjb/bufalloc_1.c b/src/libstddjb/bufalloc_1.c index 6e636ca..08fbf06 100644 --- a/src/libstddjb/bufalloc_1.c +++ b/src/libstddjb/bufalloc_1.c @@ -5,5 +5,4 @@ #include #include -static bufalloc b = BUFALLOC_INIT(&fd_write, 1) ; -bufalloc_ref bufalloc_1 = &b ; +bufalloc bufalloc_1_ = BUFALLOC_INIT(&fd_write, 1) ; diff --git a/src/libstddjb/bufalloc_2.c b/src/libstddjb/bufalloc_2.c index bcf97da..563b64a 100644 --- a/src/libstddjb/bufalloc_2.c +++ b/src/libstddjb/bufalloc_2.c @@ -5,5 +5,4 @@ #include #include -static bufalloc b = BUFALLOC_INIT(&fd_write, 2) ; -bufalloc_ref bufalloc_2 = &b ; +bufalloc bufalloc_2_ = BUFALLOC_INIT(&fd_write, 2) ; diff --git a/src/libstddjb/bufalloc_clean.c b/src/libstddjb/bufalloc_clean.c index 28bd35e..79b5880 100644 --- a/src/libstddjb/bufalloc_clean.c +++ b/src/libstddjb/bufalloc_clean.c @@ -3,7 +3,7 @@ #include #include -void bufalloc_clean (register bufalloc_ref ba) +void bufalloc_clean (register bufalloc *ba) { if (ba->p) { diff --git a/src/libstddjb/bufalloc_flush.c b/src/libstddjb/bufalloc_flush.c index 49b2eb1..e6ddfc2 100644 --- a/src/libstddjb/bufalloc_flush.c +++ b/src/libstddjb/bufalloc_flush.c @@ -3,7 +3,7 @@ #include #include -int bufalloc_flush (bufalloc_ref ba) +int bufalloc_flush (bufalloc *ba) { ba->p += allreadwrite((iofunc_t_ref)ba->op, ba->fd, ba->x.s + ba->p, ba->x.len - ba->p) ; bufalloc_clean(ba) ; diff --git a/src/libstddjb/bufalloc_init.c b/src/libstddjb/bufalloc_init.c index ddb6b6b..921dc3d 100644 --- a/src/libstddjb/bufalloc_init.c +++ b/src/libstddjb/bufalloc_init.c @@ -3,7 +3,7 @@ #include #include -void bufalloc_init (bufalloc_ref ba, int (*op)(int, char const *, unsigned int), int fd) +void bufalloc_init (bufalloc *ba, int (*op)(int, char const *, unsigned int), int fd) { ba->x.len = 0 ; ba->op = op ; diff --git a/src/libstddjb/buffer_getall.c b/src/libstddjb/buffer_getall.c index 34db9df..4f1490b 100644 --- a/src/libstddjb/buffer_getall.c +++ b/src/libstddjb/buffer_getall.c @@ -4,7 +4,7 @@ #include #include -int buffer_getall (buffer_ref b, char *buf, unsigned int len, unsigned int *w) +int buffer_getall (buffer *b, char *buf, unsigned int len, unsigned int *w) { if (*w > len) return (errno = EINVAL, -1) ; *w += buffer_getnofill(b, buf + *w, len - *w) ; diff --git a/src/libstddjb/buffer_getallnf.c b/src/libstddjb/buffer_getallnf.c index 8a97a31..be46196 100644 --- a/src/libstddjb/buffer_getallnf.c +++ b/src/libstddjb/buffer_getallnf.c @@ -3,7 +3,7 @@ #include #include -int buffer_getallnofill (buffer_ref b, char *s, unsigned int len) +int buffer_getallnofill (buffer *b, char *s, unsigned int len) { register unsigned int r = buffer_getnofill(b, s, len) ; if (r < len) diff --git a/src/libstddjb/buffer_getvallnf.c b/src/libstddjb/buffer_getvallnf.c index 2f4b82d..15f6c3d 100644 --- a/src/libstddjb/buffer_getvallnf.c +++ b/src/libstddjb/buffer_getvallnf.c @@ -4,7 +4,7 @@ #include #include -int buffer_getvallnofill (buffer_ref b, siovec_t const *v, unsigned int n) +int buffer_getvallnofill (buffer *b, siovec_t const *v, unsigned int n) { register unsigned int r = buffer_getvnofill(b, v, n) ; if (r < siovec_len(v, n)) diff --git a/src/libstddjb/iobuffer_flush.c b/src/libstddjb/iobuffer_flush.c index 543744b..93efc9d 100644 --- a/src/libstddjb/iobuffer_flush.c +++ b/src/libstddjb/iobuffer_flush.c @@ -3,7 +3,7 @@ #include #include -int iobuffer_flush (iobuffer_ref b) +int iobuffer_flush (iobuffer *b) { if (b->isk) { diff --git a/src/libstddjb/iobuffer_init.c b/src/libstddjb/iobuffer_init.c index 561379a..fc699a0 100644 --- a/src/libstddjb/iobuffer_init.c +++ b/src/libstddjb/iobuffer_init.c @@ -2,7 +2,7 @@ #include -int iobuffer_init (iobuffer_ref b, int fdin, int fdout) +int iobuffer_init (iobuffer *b, int fdin, int fdout) { if (!iobufferk_init(&b->x.k, fdin, fdout)) goto user ; if (!iobufferk_isworking(&b->x.k)) goto fk ; diff --git a/src/libstddjb/iobuffer_kfromu.c b/src/libstddjb/iobuffer_kfromu.c index 28785e6..7f2feda 100644 --- a/src/libstddjb/iobuffer_kfromu.c +++ b/src/libstddjb/iobuffer_kfromu.c @@ -11,7 +11,7 @@ #include #include -int iobuffer_kfromu (iobufferk_ref k, iobufferu_ref u) +int iobuffer_kfromu (iobufferk *k, iobufferu *u) { struct iovec iov[2] ; siovec_t v[2] ; @@ -31,7 +31,7 @@ int iobuffer_kfromu (iobufferk_ref k, iobufferu_ref u) #include #include -int iobuffer_kfromu (iobufferk_ref k, iobufferu_ref u) +int iobuffer_kfromu (iobufferk *k, iobufferu *u) { (void)k ; (void)u ; diff --git a/src/libstddjb/iobuffer_salvage.c b/src/libstddjb/iobuffer_salvage.c index b434568..6f2c5d8 100644 --- a/src/libstddjb/iobuffer_salvage.c +++ b/src/libstddjb/iobuffer_salvage.c @@ -2,7 +2,7 @@ #include -int iobuffer_salvage (iobuffer_ref b) +int iobuffer_salvage (iobuffer *b) { iobufferu u ; if (!b->isk) return 1 ; diff --git a/src/libstddjb/iobuffer_ufromk.c b/src/libstddjb/iobuffer_ufromk.c index efb0368..778ddf2 100644 --- a/src/libstddjb/iobuffer_ufromk.c +++ b/src/libstddjb/iobuffer_ufromk.c @@ -6,7 +6,7 @@ #include -int iobuffer_ufromk (iobufferu_ref u, iobufferk_ref k) +int iobuffer_ufromk (iobufferu *u, iobufferk *k) { int in = u->b[0].fd ; u->b[0].fd = k->p[0] ; @@ -29,7 +29,7 @@ int iobuffer_ufromk (iobufferu_ref u, iobufferk_ref k) #include #include -int iobuffer_ufromk (iobufferu_ref u, iobufferk_ref k) +int iobuffer_ufromk (iobufferu *u, iobufferk *k) { (void)u ; (void)k ; diff --git a/src/libstddjb/iobufferk_fill.c b/src/libstddjb/iobufferk_fill.c index 50ac403..c811c24 100644 --- a/src/libstddjb/iobufferk_fill.c +++ b/src/libstddjb/iobufferk_fill.c @@ -9,14 +9,14 @@ #include #include -static int iobufferk_tee (iobufferk_ref k) +static int iobufferk_tee (iobufferk *k) { register int r = tee(k->fd[0], k->fd[1], IOBUFFERK_SIZE - k->n, k->nb & 1 ? SPLICE_F_NONBLOCK : 0) ; if (r > 0) k->n += r ; return r ; } -static int iobufferk_splice (iobufferk_ref k) +static int iobufferk_splice (iobufferk *k) { register int r = splice(k->fd[0], 0, k->fd[1], 0, IOBUFFERK_SIZE, k->nb ? SPLICE_F_NONBLOCK : 0) ; if (r > 0) k->n += r ; @@ -24,7 +24,7 @@ static int iobufferk_splice (iobufferk_ref k) return r ; } -static int iobufferk_fill_3 (iobufferk_ref k) +static int iobufferk_fill_3 (iobufferk *k) { register int r = splice(k->fd[0], 0, k->p[1], 0, IOBUFFERK_SIZE - k->n, k->nb & 1 ? SPLICE_F_NONBLOCK : 0) ; if (r > 0) k->n += r ; diff --git a/src/libstddjb/iobufferk_finish.c b/src/libstddjb/iobufferk_finish.c index ef20d57..f743328 100644 --- a/src/libstddjb/iobufferk_finish.c +++ b/src/libstddjb/iobufferk_finish.c @@ -8,19 +8,19 @@ #include #include -static void iobufferk_nop (iobufferk_ref k) +static void iobufferk_nop (iobufferk *k) { (void)k ; } -static void iobufferk_finish_0 (iobufferk_ref k) +static void iobufferk_finish_0 (iobufferk *k) { register int e = errno ; fd_close(k->p[1]) ; errno = e ; } -static void iobufferk_finish_3 (iobufferk_ref k) +static void iobufferk_finish_3 (iobufferk *k) { register int e = errno ; fd_close(k->p[1]) ; @@ -37,7 +37,7 @@ iobufferk_finish_func_t_ref const iobufferk_finish_f[4] = #include -static void iobufferk_nop (iobufferk_ref k) +static void iobufferk_nop (iobufferk *k) { (void)k ; } diff --git a/src/libstddjb/iobufferk_init.c b/src/libstddjb/iobufferk_init.c index 03f7fae..7affabd 100644 --- a/src/libstddjb/iobufferk_init.c +++ b/src/libstddjb/iobufferk_init.c @@ -9,7 +9,7 @@ #include #include -static int iobufferk_init_0 (iobufferk_ref k) +static int iobufferk_init_0 (iobufferk *k) { register int fd = open_write("/dev/null") ; if (fd < 0) return 0 ; @@ -23,13 +23,13 @@ static int iobufferk_init_0 (iobufferk_ref k) return 1 ; } -static int iobufferk_nofd (iobufferk_ref k) +static int iobufferk_nofd (iobufferk *k) { k->p[0] = k->p[1] = -1 ; return 1 ; } -static int iobufferk_init_3 (iobufferk_ref k) +static int iobufferk_init_3 (iobufferk *k) { return (pipenbcoe(k->p) >= 0) ; } @@ -39,7 +39,7 @@ static iobufferk_io_func_t_ref iobufferk_init_f[4] = &iobufferk_init_0, &iobufferk_nofd, &iobufferk_nofd, &iobufferk_init_3 } ; -int iobufferk_init (iobufferk_ref k, int fdin, int fdout) +int iobufferk_init (iobufferk *k, int fdin, int fdout) { iobufferk tmp ; struct stat st ; @@ -67,7 +67,7 @@ int iobufferk_init (iobufferk_ref k, int fdin, int fdout) #include #include -int iobufferk_init (iobufferk_ref k, int fdin, int fdout) +int iobufferk_init (iobufferk *k, int fdin, int fdout) { (void)k ; (void)fdin ; diff --git a/src/libstddjb/iobufferk_isworking.c b/src/libstddjb/iobufferk_isworking.c index f02b7e0..f671f81 100644 --- a/src/libstddjb/iobufferk_isworking.c +++ b/src/libstddjb/iobufferk_isworking.c @@ -9,7 +9,7 @@ #include #include -int iobufferk_isworking (iobufferk_ref k) +int iobufferk_isworking (iobufferk *k) { /* for now splice() with a length of 0 returns 0 no matter what, so this */ /* test is useless. splice() should test the underlying filesystems even */ @@ -38,7 +38,7 @@ int iobufferk_isworking (iobufferk_ref k) #include -int iobufferk_isworking (iobufferk_ref k) +int iobufferk_isworking (iobufferk *k) { (void)k ; return 0 ; diff --git a/src/libstddjb/iobufferk_nosys.c b/src/libstddjb/iobufferk_nosys.c index 46f8be4..363e400 100644 --- a/src/libstddjb/iobufferk_nosys.c +++ b/src/libstddjb/iobufferk_nosys.c @@ -3,7 +3,7 @@ #include #include -int iobufferk_nosys (iobufferk_ref k) +int iobufferk_nosys (iobufferk *k) { (void)k ; return (errno = ENOSYS, -1) ; diff --git a/src/libstddjb/iobufferu_fill.c b/src/libstddjb/iobufferu_fill.c index 7ebb67c..de1a56c 100644 --- a/src/libstddjb/iobufferu_fill.c +++ b/src/libstddjb/iobufferu_fill.c @@ -3,7 +3,7 @@ #include #include -int iobufferu_fill (iobufferu_ref b) +int iobufferu_fill (iobufferu *b) { register int r = buffer_fill(&b->b[0]) ; b->b[1].c.n = b->b[0].c.n ; diff --git a/src/libstddjb/iobufferu_finish.c b/src/libstddjb/iobufferu_finish.c index eb3749e..612ec18 100644 --- a/src/libstddjb/iobufferu_finish.c +++ b/src/libstddjb/iobufferu_finish.c @@ -3,7 +3,7 @@ #include #include -void iobufferu_finish (iobufferu_ref b) +void iobufferu_finish (iobufferu *b) { alloc_free(b->buf) ; } diff --git a/src/libstddjb/ip46_scanlist.c b/src/libstddjb/ip46_scanlist.c index 37f2e18..6462da7 100644 --- a/src/libstddjb/ip46_scanlist.c +++ b/src/libstddjb/ip46_scanlist.c @@ -5,7 +5,7 @@ #include #include -unsigned int ip46full_scanlist (ip46full_t_ref out, unsigned int max, char const *s, unsigned int *num) +unsigned int ip46full_scanlist (ip46full_t *out, unsigned int max, char const *s, unsigned int *num) { unsigned int n = 0, w = 0 ; for (; s[w] && (n < max) ; n++) diff --git a/src/libstddjb/localtmn_from_sysclock.c b/src/libstddjb/localtmn_from_sysclock.c index 2d4e4fd..08e64b7 100644 --- a/src/libstddjb/localtmn_from_sysclock.c +++ b/src/libstddjb/localtmn_from_sysclock.c @@ -3,7 +3,7 @@ #include #include -int localtmn_from_sysclock (localtmn_t_ref l, tain_t const *a, int tz) +int localtmn_from_sysclock (localtmn_t *l, tain_t const *a, int tz) { struct tm t ; if (!localtm_from_sysclock(&t, a->sec.x, tz)) return 0 ; diff --git a/src/libstddjb/localtmn_from_tain.c b/src/libstddjb/localtmn_from_tain.c index a3d3f6e..78cc051 100644 --- a/src/libstddjb/localtmn_from_tain.c +++ b/src/libstddjb/localtmn_from_tain.c @@ -3,7 +3,7 @@ #include #include -int localtmn_from_tain (localtmn_t_ref l, tain_t const *a, int tz) +int localtmn_from_tain (localtmn_t *l, tain_t const *a, int tz) { struct tm t ; if (!localtm_from_tai(&t, tain_secp(a), tz)) return 0 ; diff --git a/src/libstddjb/localtmn_scan.c b/src/libstddjb/localtmn_scan.c index f33ab51..087c642 100644 --- a/src/libstddjb/localtmn_scan.c +++ b/src/libstddjb/localtmn_scan.c @@ -3,7 +3,7 @@ #include #include -unsigned int localtmn_scan (char const *s, localtmn_t_ref l) +unsigned int localtmn_scan (char const *s, localtmn_t *l) { localtmn_t m ; unsigned int n = localtm_scan(s, &m.tm) ; diff --git a/src/libstddjb/socket_local46.c b/src/libstddjb/socket_local46.c index a53bcac..6235527 100644 --- a/src/libstddjb/socket_local46.c +++ b/src/libstddjb/socket_local46.c @@ -10,7 +10,7 @@ #ifdef SKALIBS_IPV6_ENABLED -int socket_local46 (int s, ip46_t_ref ip, uint16 *port) +int socket_local46 (int s, ip46_t *ip, uint16 *port) { struct sockaddr sa ; socklen_t dummy = sizeof sa ; diff --git a/src/libstddjb/socket_remote46.c b/src/libstddjb/socket_remote46.c index 835b7c9..bf6b934 100644 --- a/src/libstddjb/socket_remote46.c +++ b/src/libstddjb/socket_remote46.c @@ -10,7 +10,7 @@ #ifdef SKALIBS_IPV6_ENABLED -int socket_remote46 (int s, ip46_t_ref ip, uint16 *port) +int socket_remote46 (int s, ip46_t *ip, uint16 *port) { struct sockaddr sa ; socklen_t dummy = sizeof sa ; diff --git a/src/libstddjb/subgetopt.c b/src/libstddjb/subgetopt.c index 69201c6..67cdfa1 100644 --- a/src/libstddjb/subgetopt.c +++ b/src/libstddjb/subgetopt.c @@ -3,7 +3,7 @@ #undef SUBGETOPT_SHORT #include -int subgetopt_r (int argc, char const *const *argv, char const *opts, subgetopt_t_ref o) +int subgetopt_r (int argc, char const *const *argv, char const *opts, subgetopt_t *o) { o->arg = 0 ; if ((o->ind >= argc) || !argv[o->ind]) return -1 ; -- cgit v1.2.3