From b2242ae0f01b9fa4d791c3c74ce2a6383c6d27b1 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 24 Mar 2004 20:10:03 +0000 Subject: [project @ 2004-03-24 20:10:03 by jmb] Remove need for XML parse tree to be kept in memory. The source document is now reparsed when saving complete. svn path=/import/netsurf/; revision=662 --- riscos/save_complete.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'riscos') diff --git a/riscos/save_complete.c b/riscos/save_complete.c index 0738f2240..d63ceedf0 100644 --- a/riscos/save_complete.c +++ b/riscos/save_complete.c @@ -58,7 +58,7 @@ void save_complete(struct content *c) { unsigned int i; struct url_entry urls = {0, 0, 0, 0}; /* sentinel at head */ struct url_entry *object; - xmlDoc *toSave; + htmlParserCtxtPtr toSave; if (c->type != CONTENT_HTML) return; @@ -136,26 +136,28 @@ void save_complete(struct content *c) { } /* make a copy of the document tree */ - toSave = xmlCopyDoc(c->data.html.document, 1); - - if (!toSave) { + toSave = htmlCreateMemoryParserCtxt(c->source_data, c->source_size); + if (htmlParseDocument(toSave) == -1) { + htmlFreeParserCtxt(toSave); xfree(spath); return; } /* rewrite all urls we know about */ - if (rewrite_document_urls(toSave, &urls, fname) == 0) { + if (rewrite_document_urls(toSave->myDoc, &urls, fname) == 0) { xfree(spath); - xmlFreeDoc(toSave); + xmlFreeDoc(toSave->myDoc); + htmlFreeParserCtxt(toSave); return; } /* save the html file out last of all */ sprintf(spath, "%s%s", SAVE_PATH, fname); - htmlSaveFile(spath, toSave); + htmlSaveFile(spath, toSave->myDoc); xosfile_set_type(spath, 0xfaf); - xmlFreeDoc(toSave); + xmlFreeDoc(toSave->myDoc); + htmlFreeParserCtxt(toSave); xfree(spath); //xfree(fname); } -- cgit v1.2.3