From 0204a4ff10292047628c754b0d088a742b511bb3 Mon Sep 17 00:00:00 2001 From: Jan 'Moskyt' Matejka Date: Wed, 11 Jul 2012 16:46:44 +0200 Subject: [PATCH] Fastbuf: fbmulti: *'s and whitespace --- ucw/fastbuf.h | 7 ++++--- ucw/fb-multi.c | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ucw/fastbuf.h b/ucw/fastbuf.h index 564593dd..5c3ad129 100644 --- a/ucw/fastbuf.h +++ b/ucw/fastbuf.h @@ -488,8 +488,8 @@ static inline void fbatomic_commit(struct fastbuf *b) * * This backend is seekable iff all of the supplied fastbufs are seekable. * - * Also, please be aware of direct operations on the underlying buffers. The - * fbmulti backend doesn't expect you doing something directly on them. + * You aren't allowed to do anything with the underlying buffers while these + * are connected into fbmulti. * * You may init a fbmulti by @fbmulti_create(bufsize, fb1, fb2, ..., NULL). * This call returns a fastbuf that concatenates all the given fastbufs. @@ -511,10 +511,11 @@ static inline void fbatomic_commit(struct fastbuf *b) * For performance reasons, use @fbmulti_flatten() only once, just before reading. ***/ -struct fastbuf* fbmulti_create(uns bufsize, ...) SENTINEL_CHECK; +struct fastbuf *fbmulti_create(uns bufsize, ...) SENTINEL_CHECK; void fbmulti_append(struct fastbuf *f, struct fastbuf *fa, int allow_close); void fbmulti_flatten(struct fastbuf *f); + /*** === Configuring stream parameters [[bconfig]] ***/ enum bconfig_type { /** Parameters that could be configured. **/ diff --git a/ucw/fb-multi.c b/ucw/fb-multi.c index 876aac8b..0bf6d9e4 100644 --- a/ucw/fb-multi.c +++ b/ucw/fb-multi.c @@ -18,10 +18,10 @@ struct fb_multi { struct fastbuf fb; - struct mempool* mp; - struct subbuf* cur; + struct mempool *mp; + struct subbuf *cur; ucw_off_t len; - clist* subbufs; + clist *subbufs; }; #define FB_MULTI(f) ((struct fb_multi *)(f)) @@ -30,7 +30,7 @@ struct subbuf { cnode n; ucw_off_t begin, end; int allow_close; - struct fastbuf* fb; + struct fastbuf *fb; }; static void @@ -46,7 +46,7 @@ fbmulti_subbuf_get_end(struct subbuf *s) static int fbmulti_subbuf_next(struct fastbuf *f) { - struct subbuf* next = clist_next(FB_MULTI(f)->subbufs, &FB_MULTI(f)->cur->n); + struct subbuf *next = clist_next(FB_MULTI(f)->subbufs, &FB_MULTI(f)->cur->n); if (next == NULL) return 0; @@ -171,7 +171,7 @@ fbmulti_close(struct fastbuf *f) mp_delete(FB_MULTI(f)->mp); } -struct fastbuf* +struct fastbuf * fbmulti_create(uns bufsize, ...) { struct mempool *mp = mp_new(bufsize); @@ -179,7 +179,7 @@ fbmulti_create(uns bufsize, ...) FB_MULTI(fb_out)->mp = mp; struct fastbuf *fb_in; - clist* subbufs = mp_alloc(mp, sizeof(clist)); + clist *subbufs = mp_alloc(mp, sizeof(clist)); clist_init(subbufs); FB_MULTI(fb_out)->subbufs = subbufs; @@ -212,7 +212,7 @@ fbmulti_append(struct fastbuf *f, struct fastbuf *fb, int allow_close) clist_add_tail(FB_MULTI(f)->subbufs, &(sb->n)); } -static void fbmulti_flatten_internal(struct fastbuf *f, clist* c, int allow_close) +static void fbmulti_flatten_internal(struct fastbuf *f, clist *c, int allow_close) { CLIST_FOR_EACH(struct subbuf *, n, *c) { @@ -241,7 +241,7 @@ fbmulti_flatten(struct fastbuf *f) return; } - clist* c = FB_MULTI(f)->subbufs; + clist *c = FB_MULTI(f)->subbufs; FB_MULTI(f)->subbufs = mp_alloc(FB_MULTI(f)->mp, sizeof(clist)); clist_init(FB_MULTI(f)->subbufs); @@ -253,7 +253,7 @@ fbmulti_flatten(struct fastbuf *f) #ifdef TEST -int main(int argc, char ** argv) +int main(int argc, char **argv) { if (argc < 2) { @@ -269,7 +269,7 @@ int main(int argc, char ** argv) for (uns i=0;i