summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2017-02-04 10:59:21 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2017-02-04 10:59:21 (GMT)
commit191566a22ca6b5555b1ad688507f7877c3f26463 (patch)
treedc64f144eab3812f699eab09519fb6f672876e0c
parent17d7f6097c3f89ff2d505d70141fb136d38a88bf (diff)
downloadlibnslayout-191566a22ca6b5555b1ad688507f7877c3f26463.tar.gz
libnslayout-191566a22ca6b5555b1ad688507f7877c3f26463.tar.bz2
dom watcher: Tidy node type string array.
-rw-r--r--src/dom/watcher.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/dom/watcher.c b/src/dom/watcher.c
index ff31484..00a023a 100644
--- a/src/dom/watcher.c
+++ b/src/dom/watcher.c
@@ -26,23 +26,22 @@
*/
static const char *nsl__dom_node_type_to_string(dom_node_type type)
{
- const char *str[] = {
- "ELEMENT_NODE",
- "ATTRIBUTE_NODE",
- "TEXT_NODE",
- "CDATA_SECTION_NODE",
- "ENTITY_REFERENCE_NODE",
- "ENTITY_NODE",
- "PROCESSING_INSTRUCTION_NODE",
- "COMMENT_NODE",
- "DOCUMENT_NODE",
- "DOCUMENT_TYPE_NODE",
- "DOCUMENT_FRAGMENT_NODE",
- "NOTATION_NODE"
+ static const char *str[DOM_NODE_TYPE_COUNT] = {
+ [DOM_ELEMENT_NODE] = "ELEMENT_NODE",
+ [DOM_ATTRIBUTE_NODE] = "ATTRIBUTE_NODE",
+ [DOM_TEXT_NODE] = "TEXT_NODE",
+ [DOM_CDATA_SECTION_NODE] = "CDATA_SECTION_NODE",
+ [DOM_ENTITY_REFERENCE_NODE] = "ENTITY_REFERENCE_NODE",
+ [DOM_ENTITY_NODE] = "ENTITY_NODE",
+ [DOM_PROCESSING_INSTRUCTION_NODE] = "PROCESSING_INSTRUCTION_NODE",
+ [DOM_COMMENT_NODE] = "COMMENT_NODE",
+ [DOM_DOCUMENT_NODE] = "DOCUMENT_NODE",
+ [DOM_DOCUMENT_TYPE_NODE] = "DOCUMENT_TYPE_NODE",
+ [DOM_DOCUMENT_FRAGMENT_NODE] = "DOCUMENT_FRAGMENT_NODE",
+ [DOM_NOTATION_NODE] = "NOTATION_NODE"
};
- assert(DOM_NODE_TYPE_COUNT == 12);
- return str[type - 1];
+ return str[type];
}
/**