void eb_set_charset(EditBuffer *b, QECharset *charset) { if (b->charset) { charset_decode_close(&b->charset_state); } b->charset = charset; charset_decode_init(&b->charset_state, charset); }
CSSBox *xml_end(XMLState *s) { CSSBox *root_box; /* flush the lookahead buffer */ if (s->lookahead_size > 0) { /* mark the end to stop parsing function */ s->lookahead_buf[s->lookahead_size] = '\0'; xml_parse_internal(s, s->lookahead_buf, s->lookahead_size, NULL, 0); } if (s->charset) { charset_decode_close(&s->charset_state); s->charset = NULL; } strbuf_reset(&s->str); root_box = s->root_box; free(s); return root_box; }