* of the GNU Lesser General Public License.
*/
-#include "ucw/lib.h"
-#include "ucw/mempool.h"
-#include "ucw/fastbuf.h"
+#include <ucw/lib.h>
+#include <ucw/mempool.h>
+#include <ucw/fastbuf.h>
#include <stdio.h>
#include <stdlib.h>
-#define FB_POOL(f) ((struct fbpool *)(f)->is_fastbuf)
+#define FB_POOL(f) ((struct fbpool *)(f))
static void
fbpool_spout(struct fastbuf *b)
{
- if (b->bptr >= b->bufend)
+ if (b->bptr == b->bufend)
{
uns len = b->bufend - b->buffer;
- b->buffer = mp_expand(FB_POOL(b)->mp);
+ b->bstop = b->buffer = mp_expand(FB_POOL(b)->mp);
b->bufend = b->buffer + mp_avail(FB_POOL(b)->mp);
- b->bstop = b->buffer;
b->bptr = b->buffer + len;
}
}
void *
fbpool_end(struct fbpool *b)
{
- return mp_end(b->mp, b->fb.bptr);
+ return mp_end(b->mp, b->fb.bptr);
}
void
struct fbpool fb;
byte *p;
uns l;
-
+
mp = mp_new(64);
fbpool_init(&fb);
fbpool_start(&fb, mp, 16);
if (memcmp(p + i * 7, "<hello>", 7))
ASSERT(0);
mp_delete(mp);
-
+
return 0;
}