-static void
-xml_chars_spout(struct fastbuf *fb)
-{
- if (fb->bptr >= fb->bufend)
- {
- struct xml_context *ctx = SKIP_BACK(struct xml_context, chars, fb);
- struct mempool *pool = ctx->pool;
- if (fb->bufend != fb->buffer)
- {
- uns len = fb->bufend - fb->buffer;
- TRACE(ctx, "grow_chars");
- fb->buffer = mp_expand(pool);
- fb->bufend = fb->buffer + mp_avail(pool);
- fb->bstop = fb->buffer;
- fb->bptr = fb->buffer + len;
- }
- else
- {
- TRACE(ctx, "push_chars");
- struct xml_node *n = xml_push_dom(ctx);
- n->type = XML_NODE_CHARS;
- xml_start_chars(ctx);
- }
- }
-}
-
-static void
-xml_init_chars(struct xml_context *ctx)
-{
- struct fastbuf *fb = &ctx->chars;
- fb->name = "<xml-chars>";
- fb->spout = xml_chars_spout;
- fb->can_overwrite_buffer = 1;
- fb->bptr = fb->bstop = fb->buffer = fb->bufend = NULL;
-}
-