mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Move parser root node initialization to init_sgml_parser()
... parse_sgml() in theory should be able to be called multiple times.
This commit is contained in:
parent
b1a48b6b4f
commit
b06a8adeac
@ -320,6 +320,12 @@ init_sgml_parser(enum sgml_parser_type type, void *renderer, struct uri *uri,
|
||||
init_dom_stack(&parser->stack, parser, renderer,
|
||||
push_callbacks, pop_callbacks, obj_size);
|
||||
|
||||
parser->root = add_sgml_document(&parser->stack, parser->uri);
|
||||
if (!parser->root) {
|
||||
mem_free(parser);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return parser;
|
||||
}
|
||||
|
||||
@ -342,10 +348,8 @@ parse_sgml(struct sgml_parser *parser, struct string *buffer)
|
||||
|
||||
init_scanner(&parser->scanner, &sgml_scanner_info, source, end);
|
||||
|
||||
parser->root = add_sgml_document(&parser->stack, parser->uri);
|
||||
if (parser->root) {
|
||||
parse_sgml_document(&parser->stack, &parser->scanner);
|
||||
}
|
||||
/* FIXME: Make parse_sgml_document() return an error code. */
|
||||
parse_sgml_document(&parser->stack, &parser->scanner);
|
||||
|
||||
return parser->root;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user