mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
Change parse_sgml() to take buf+bufsize instead of DOM string
This commit is contained in:
parent
0c866fd8ae
commit
0950996dd8
@ -981,7 +981,6 @@ render_dom_document(struct cache_entry *cached, struct document *document,
|
||||
unsigned char *string = struri(cached->uri);
|
||||
size_t length = strlen(string);
|
||||
struct dom_string uri = INIT_DOM_STRING(string, length);
|
||||
struct dom_string source = INIT_DOM_STRING(buffer->source, buffer->length);
|
||||
enum sgml_parser_code code;
|
||||
|
||||
convert_table = get_convert_table(head, document->options.cp,
|
||||
@ -1035,7 +1034,7 @@ render_dom_document(struct cache_entry *cached, struct document *document,
|
||||
* However, it will be useful when we will be able to also
|
||||
* incrementally parse new data. This will require the parser to live
|
||||
* during the fetching of data. */
|
||||
code = parse_sgml(parser, &source, 1);
|
||||
code = parse_sgml(parser, buffer->source, buffer->length, 1);
|
||||
if (parser->root) {
|
||||
assert(parser->stack.depth == 1);
|
||||
|
||||
|
@ -400,8 +400,10 @@ parse_sgml_plain(struct dom_stack *stack, struct dom_scanner *scanner)
|
||||
}
|
||||
|
||||
enum sgml_parser_code
|
||||
parse_sgml(struct sgml_parser *parser, struct dom_string *buffer, int complete)
|
||||
parse_sgml(struct sgml_parser *parser, unsigned char *buf, size_t bufsize,
|
||||
int complete)
|
||||
{
|
||||
struct dom_string source = INIT_DOM_STRING(buf, bufsize);
|
||||
struct sgml_parsing_state *parsing;
|
||||
enum sgml_parser_code code;
|
||||
|
||||
@ -415,7 +417,7 @@ parse_sgml(struct sgml_parser *parser, struct dom_string *buffer, int complete)
|
||||
get_dom_stack_top(&parser->stack)->immutable = 1;
|
||||
}
|
||||
|
||||
parsing = init_sgml_parsing_state(parser, buffer);
|
||||
parsing = init_sgml_parsing_state(parser, &source);
|
||||
if (!parsing) return SGML_PARSER_CODE_MEM_ALLOC;
|
||||
|
||||
code = parse_sgml_plain(&parser->stack, &parsing->scanner);
|
||||
|
@ -137,14 +137,15 @@ void done_sgml_parser(struct sgml_parser *parser);
|
||||
* signals through the `complete` parameter.
|
||||
*
|
||||
* parser:: A parser created with ref:[init_sgml_parser].
|
||||
* buffer:: A string containing the chunk to parse.
|
||||
* buf:: A buffer containing the chunk to parse.
|
||||
* bufsize:: The size of the buffer given in the buf parameter.
|
||||
* complete:: Whether this is the last chunk to parse.
|
||||
*
|
||||
* The returned code is ref:[SGML_PARSER_CODE_OK] if the buffer was
|
||||
* successfully parserd, else a code hinting at the error.
|
||||
*/
|
||||
enum sgml_parser_code
|
||||
parse_sgml(struct sgml_parser *parser, struct dom_string *buffer, int complete);
|
||||
parse_sgml(struct sgml_parser *parser, unsigned char *buf, size_t bufsize, int complete);
|
||||
|
||||
/** Get the line position in the source
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user