summaryrefslogtreecommitdiff
path: root/src/core/document.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2012-07-05 09:34:58 +0100
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2012-07-05 09:34:58 +0100
commitf1a0330ff6b4ccbc3c1917c801b8a35da098fc45 (patch)
treec77b4b657d5a1027deefc070075d7bbe1b3d9874 /src/core/document.c
parent65a011d0c6ce6f142b3c8fcf612d982ba60fa3aa (diff)
downloadlibdom-f1a0330ff6b4ccbc3c1917c801b8a35da098fc45.tar.gz
libdom-f1a0330ff6b4ccbc3c1917c801b8a35da098fc45.tar.bz2
DOMDocument: Memoize the empty string
Diffstat (limited to 'src/core/document.c')
-rw-r--r--src/core/document.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/document.c b/src/core/document.c
index 5a286fc..c43f0bc 100644
--- a/src/core/document.c
+++ b/src/core/document.c
@@ -140,6 +140,16 @@ dom_exception _dom_document_initialise(dom_document *doc,
if (err != DOM_NO_ERR)
return err;
+ /* Intern the empty string. The use of a space in the constant
+ * is to prevent the compiler warning about an empty string.
+ */
+ err = dom_string_create_interned((const uint8_t *) ' ', 0,
+ &doc->_memo_empty);
+ if (err != DOM_NO_ERR) {
+ dom_string_unref(doc->class_string);
+ return err;
+ }
+
/* We should not pass a NULL when all things hook up */
return _dom_document_event_internal_initialise(doc, &doc->dei, daf);
}