1
0
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:
Jonas Fonseca 2005-12-06 12:30:53 +01:00 committed by Jonas Fonseca
parent b1a48b6b4f
commit b06a8adeac

View File

@ -320,6 +320,12 @@ init_sgml_parser(enum sgml_parser_type type, void *renderer, struct uri *uri,
init_dom_stack(&parser->stack, parser, renderer, init_dom_stack(&parser->stack, parser, renderer,
push_callbacks, pop_callbacks, obj_size); 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; return parser;
} }
@ -342,10 +348,8 @@ parse_sgml(struct sgml_parser *parser, struct string *buffer)
init_scanner(&parser->scanner, &sgml_scanner_info, source, end); init_scanner(&parser->scanner, &sgml_scanner_info, source, end);
parser->root = add_sgml_document(&parser->stack, parser->uri); /* FIXME: Make parse_sgml_document() return an error code. */
if (parser->root) { parse_sgml_document(&parser->stack, &parser->scanner);
parse_sgml_document(&parser->stack, &parser->scanner);
}
return parser->root; return parser->root;
} }