1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

[document] Slightly better handling of string

This commit is contained in:
Witold Filipczyk 2023-09-28 12:04:57 +02:00
parent 98e72e99f3
commit 6487a287cf
3 changed files with 8 additions and 6 deletions

View File

@ -310,9 +310,6 @@ reset_document(struct document *document)
#if defined(CONFIG_ECMASCRIPT_SMJS) || defined(CONFIG_QUICKJS) || defined(CONFIG_MUJS) #if defined(CONFIG_ECMASCRIPT_SMJS) || defined(CONFIG_QUICKJS) || defined(CONFIG_MUJS)
free_ecmascript_string_list(&document->onload_snippets); free_ecmascript_string_list(&document->onload_snippets);
free_uri_list(&document->ecmascript_imports); free_uri_list(&document->ecmascript_imports);
if (document->text.length) {
done_string(&document->text);
}
mem_free_set(&document->body_onkeypress, NULL); mem_free_set(&document->body_onkeypress, NULL);
/// kill_timer(&document->timeout); /// kill_timer(&document->timeout);
/// free_document(document->dom); /// free_document(document->dom);
@ -403,9 +400,7 @@ done_document(struct document *document)
#endif #endif
#ifdef CONFIG_LIBDOM #ifdef CONFIG_LIBDOM
if (document->text.length) {
done_string(&document->text); done_string(&document->text);
}
free_document(document->dom); free_document(document->dom);
if (document->element_map) { if (document->element_map) {

View File

@ -268,6 +268,10 @@ render_source_document_cxx(struct cache_entry *cached, struct document *document
if (!buffer->length) { if (!buffer->length) {
if (document->text.length) { if (document->text.length) {
done_string(&document->text); done_string(&document->text);
if (!init_string(&document->text)) {
return;
}
} }
mapa = document->element_map; mapa = document->element_map;

View File

@ -319,6 +319,9 @@ dump_xhtml(struct cache_entry *cached, struct document *document, int parse)
if (1) { if (1) {
if (document->text.length) { if (document->text.length) {
done_string(&document->text); done_string(&document->text);
if (!init_string(&document->text)) {
return;
}
} }
mapa = document->element_map; mapa = document->element_map;