X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Ffastbuf.h;h=4f0d99d3190be67c6fad8ae22e4e11a46760167d;hb=06cac26f0d8895b5cb8fbe03ca96444dc4ac8d51;hp=40b60dcac5e2075a601e3d755f95a42a3ac06b9f;hpb=9fa0d3b00b6e436831d37ff6257a6ee8b222fa8e;p=libucw.git diff --git a/ucw/fastbuf.h b/ucw/fastbuf.h index 40b60dca..4f0d99d3 100644 --- a/ucw/fastbuf.h +++ b/ucw/fastbuf.h @@ -491,35 +491,34 @@ static inline void fbatomic_commit(struct fastbuf *b) * 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. - * The last parameter of @fbmulti_create must be NULL. + * The fbmulti is inited by @fbmulti_create(). It returns an empty fbmulti. + * Then you call @fbmulti_append() for each fbmulti. * - * By default, if @bclose() is called on fbmulti, all the underlying buffers - * get closed recursively. + * If @bclose() is called on fbmulti, all the underlying buffers get closed + * recursively. * - * You may init a fbmulti by @fbmulti_create(bufsize) with no underlying buffers - * and then append the underlying buffers one by one. If allow_close is set to 0, - * the fastbuf doesn't get closed at @bclose() and you have to do the cleanup on - * yourself. + * If you want to keep an underlying fastbuf open after @bclose, just remove it + * by @fbmulti_remove where the second parameter is a pointer to the removed + * fastbuf. If you pass NULL, all the underlying fastbufs are removed. * - * If used in some formatter, you'll probably have a large and deep structure - * of nested fastbufs. Just before reading from the fbmulti, you may call - * @fbmulti_flatten() to flatten the structure. After @fbmulti_flatten(), the - * fbmulti is seeked to the beginning, flushed and ready to read the whole buffer. - * - * For performance reasons, use @fbmulti_flatten() only once, just before reading. - * - * If you want to remove a fastbuf from the chain, just call @fbmulti_remove - * where the second parameter is a pointer to the removed fastbuf. If you pass - * NULL, all the underlying fastbufs are removed. + * After @fbmulti_remove, the state of the fbmulti is undefined. The only allowed + * operation is either another @fbmulti_remove or @bclose on the fbmulti. ***/ -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); -void fbmulti_remove(struct fastbuf *f, struct fastbuf *fb); +/** + * Create an empty fbmulti + **/ +struct fastbuf *fbmulti_create(void); +/** + * Append a fb to fbmulti + **/ +void fbmulti_append(struct fastbuf *f, struct fastbuf *fb); + +/** + * Remove a fb from fbmulti + **/ +void fbmulti_remove(struct fastbuf *f, struct fastbuf *fb); /*** === Configuring stream parameters [[bconfig]] ***/