mirror of
https://github.com/rkd77/elinks.git
synced 2025-06-30 22:19:29 -04:00
Make parse_sgml() take buffer as dom_string struct
This commit is contained in:
parent
11e168aba4
commit
d1e275be52
@ -673,6 +673,7 @@ render_dom_document(struct cache_entry *cached, struct document *document,
|
|||||||
unsigned char *string = struri(cached->uri);
|
unsigned char *string = struri(cached->uri);
|
||||||
size_t length = strlen(string);
|
size_t length = strlen(string);
|
||||||
struct dom_string uri = INIT_DOM_STRING(string, length);
|
struct dom_string uri = INIT_DOM_STRING(string, length);
|
||||||
|
struct dom_string source = INIT_DOM_STRING(buffer->source, buffer->length);
|
||||||
|
|
||||||
assert(document->options.plain);
|
assert(document->options.plain);
|
||||||
|
|
||||||
@ -699,7 +700,7 @@ render_dom_document(struct cache_entry *cached, struct document *document,
|
|||||||
&dom_source_renderer_context_info);
|
&dom_source_renderer_context_info);
|
||||||
add_dom_stack_tracer(&parser->stack);
|
add_dom_stack_tracer(&parser->stack);
|
||||||
|
|
||||||
root = parse_sgml(parser, buffer);
|
root = parse_sgml(parser, &source);
|
||||||
if (root) {
|
if (root) {
|
||||||
assert(parser->stack.depth == 1);
|
assert(parser->stack.depth == 1);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
static struct sgml_parsing_state *
|
static struct sgml_parsing_state *
|
||||||
init_sgml_parsing_state(struct sgml_parser *parser, struct string *buffer);
|
init_sgml_parsing_state(struct sgml_parser *parser, struct dom_string *buffer);
|
||||||
|
|
||||||
|
|
||||||
/* When getting the sgml_parser struct it is _always_ assumed that the parser
|
/* When getting the sgml_parser struct it is _always_ assumed that the parser
|
||||||
@ -321,7 +321,7 @@ parse_sgml_plain(struct dom_stack *stack, struct dom_scanner *scanner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct dom_node *
|
struct dom_node *
|
||||||
parse_sgml(struct sgml_parser *parser, struct string *buffer)
|
parse_sgml(struct sgml_parser *parser, struct dom_string *buffer)
|
||||||
{
|
{
|
||||||
struct sgml_parsing_state *parsing;
|
struct sgml_parsing_state *parsing;
|
||||||
|
|
||||||
@ -419,12 +419,12 @@ static struct dom_stack_context_info sgml_parsing_context_info = {
|
|||||||
|
|
||||||
/* Create a new parsing state by pushing a new text node containing the*/
|
/* Create a new parsing state by pushing a new text node containing the*/
|
||||||
static struct sgml_parsing_state *
|
static struct sgml_parsing_state *
|
||||||
init_sgml_parsing_state(struct sgml_parser *parser, struct string *buffer)
|
init_sgml_parsing_state(struct sgml_parser *parser, struct dom_string *buffer)
|
||||||
{
|
{
|
||||||
struct dom_stack_state *state;
|
struct dom_stack_state *state;
|
||||||
struct dom_node *node;
|
struct dom_node *node;
|
||||||
|
|
||||||
node = init_dom_node(DOM_NODE_TEXT, buffer->source, buffer->length);
|
node = init_dom_node(DOM_NODE_TEXT, buffer->string, buffer->length);
|
||||||
if (!node || !push_dom_node(&parser->parsing, node))
|
if (!node || !push_dom_node(&parser->parsing, node))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -57,6 +57,6 @@ init_sgml_parser(enum sgml_parser_type type, enum sgml_document_type doctype,
|
|||||||
|
|
||||||
void done_sgml_parser(struct sgml_parser *parser);
|
void done_sgml_parser(struct sgml_parser *parser);
|
||||||
|
|
||||||
struct dom_node *parse_sgml(struct sgml_parser *parser, struct string *buffer);
|
struct dom_node *parse_sgml(struct sgml_parser *parser, struct dom_string *buffer);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user