summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2021-02-02 12:31:20 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2021-02-02 12:31:49 +0000
commita2ffae698d4c12d9457c62b79eddd4342e2e213c (patch)
tree16c81f644924bcdd180f31a8e01bf7375ccccb43 /src/core
parentc90f98b7d5bdaecb1c497b155af5347aedb1d617 (diff)
downloadlibdom-a2ffae698d4c12d9457c62b79eddd4342e2e213c.tar.gz
libdom-a2ffae698d4c12d9457c62b79eddd4342e2e213c.tar.bz2
Constify vtables.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/attr.c4
-rw-r--r--src/core/cdatasection.c2
-rw-r--r--src/core/characterdata.c2
-rw-r--r--src/core/characterdata.h2
-rw-r--r--src/core/comment.c2
-rw-r--r--src/core/doc_fragment.c4
-rw-r--r--src/core/document.c4
-rw-r--r--src/core/document_type.c4
-rw-r--r--src/core/element.c4
-rw-r--r--src/core/element.h2
-rw-r--r--src/core/entity_ref.c4
-rw-r--r--src/core/node.c4
-rw-r--r--src/core/node.h2
-rw-r--r--src/core/pi.c4
-rw-r--r--src/core/text.c4
-rw-r--r--src/core/text.h2
16 files changed, 25 insertions, 25 deletions
diff --git a/src/core/attr.c b/src/core/attr.c
index e18e2a7..8fcaac3 100644
--- a/src/core/attr.c
+++ b/src/core/attr.c
@@ -49,7 +49,7 @@ struct dom_attr {
};
/* The vtable for dom_attr node */
-static struct dom_attr_vtable attr_vtable = {
+static const struct dom_attr_vtable attr_vtable = {
{
{
DOM_NODE_EVENT_TARGET_VTABLE,
@@ -60,7 +60,7 @@ static struct dom_attr_vtable attr_vtable = {
};
/* The protected vtable for dom_attr */
-static struct dom_node_protect_vtable attr_protect_vtable = {
+static const struct dom_node_protect_vtable attr_protect_vtable = {
DOM_ATTR_PROTECT_VTABLE
};
diff --git a/src/core/cdatasection.c b/src/core/cdatasection.c
index c6812e3..efba237 100644
--- a/src/core/cdatasection.c
+++ b/src/core/cdatasection.c
@@ -20,7 +20,7 @@ struct dom_cdata_section {
dom_text base; /**< Base node */
};
-static struct dom_node_protect_vtable cdata_section_protect_vtable = {
+static const struct dom_node_protect_vtable cdata_section_protect_vtable = {
DOM_CDATA_SECTION_PROTECT_VTABLE
};
diff --git a/src/core/characterdata.c b/src/core/characterdata.c
index ea665b3..e6f5dbe 100644
--- a/src/core/characterdata.c
+++ b/src/core/characterdata.c
@@ -21,7 +21,7 @@
/* The virtual functions for dom_characterdata, we make this vtable
* public to each child class */
-struct dom_characterdata_vtable characterdata_vtable = {
+const struct dom_characterdata_vtable characterdata_vtable = {
{
{
DOM_NODE_EVENT_TARGET_VTABLE
diff --git a/src/core/characterdata.h b/src/core/characterdata.h
index 0b0889c..c8f4db3 100644
--- a/src/core/characterdata.h
+++ b/src/core/characterdata.h
@@ -116,7 +116,7 @@ dom_exception _dom_characterdata_copy(dom_node_internal *old,
_dom_characterdata_destroy, \
_dom_characterdata_copy
-extern struct dom_characterdata_vtable characterdata_vtable;
+extern const struct dom_characterdata_vtable characterdata_vtable;
dom_exception _dom_characterdata_copy_internal(dom_characterdata *old,
dom_characterdata *new);
diff --git a/src/core/comment.c b/src/core/comment.c
index 0697826..b36a1be 100644
--- a/src/core/comment.c
+++ b/src/core/comment.c
@@ -21,7 +21,7 @@ struct dom_comment {
dom_characterdata base; /**< Base node */
};
-static struct dom_node_protect_vtable comment_protect_vtable = {
+static const struct dom_node_protect_vtable comment_protect_vtable = {
DOM_COMMENT_PROTECT_VTABLE
};
diff --git a/src/core/doc_fragment.c b/src/core/doc_fragment.c
index 96cc707..9e10a1a 100644
--- a/src/core/doc_fragment.c
+++ b/src/core/doc_fragment.c
@@ -22,14 +22,14 @@ struct dom_document_fragment {
dom_node_internal base; /**< Base node */
};
-static struct dom_node_vtable df_vtable = {
+static const struct dom_node_vtable df_vtable = {
{
DOM_NODE_EVENT_TARGET_VTABLE
},
DOM_NODE_VTABLE
};
-static struct dom_node_protect_vtable df_protect_vtable = {
+static const struct dom_node_protect_vtable df_protect_vtable = {
DOM_DF_PROTECT_VTABLE
};
diff --git a/src/core/document.c b/src/core/document.c
index 7c0bcdc..40d4cd9 100644
--- a/src/core/document.c
+++ b/src/core/document.c
@@ -42,7 +42,7 @@ struct dom_doc_nl {
};
/* The virtual functions of this dom_document */
-static struct dom_document_vtable document_vtable = {
+static const struct dom_document_vtable document_vtable = {
{
{
DOM_NODE_EVENT_TARGET_VTABLE
@@ -52,7 +52,7 @@ static struct dom_document_vtable document_vtable = {
DOM_DOCUMENT_VTABLE
};
-static struct dom_node_protect_vtable document_protect_vtable = {
+static const struct dom_node_protect_vtable document_protect_vtable = {
DOM_DOCUMENT_PROTECT_VTABLE
};
diff --git a/src/core/document_type.c b/src/core/document_type.c
index d7b1b99..a0fafdd 100644
--- a/src/core/document_type.c
+++ b/src/core/document_type.c
@@ -27,7 +27,7 @@ struct dom_document_type {
dom_string *system_id; /**< Doctype system ID */
};
-static struct dom_document_type_vtable document_type_vtable = {
+static const struct dom_document_type_vtable document_type_vtable = {
{
{
DOM_NODE_EVENT_TARGET_VTABLE
@@ -37,7 +37,7 @@ static struct dom_document_type_vtable document_type_vtable = {
DOM_DOCUMENT_TYPE_VTABLE
};
-static struct dom_node_protect_vtable dt_protect_vtable = {
+static const struct dom_node_protect_vtable dt_protect_vtable = {
DOM_DT_PROTECT_VTABLE
};
diff --git a/src/core/element.c b/src/core/element.c
index dbdd56b..3b031a0 100644
--- a/src/core/element.c
+++ b/src/core/element.c
@@ -32,7 +32,7 @@
#include "utils/list.h"
#include "events/mutation_event.h"
-struct dom_element_vtable _dom_element_vtable = {
+const struct dom_element_vtable _dom_element_vtable = {
{
{
DOM_NODE_EVENT_TARGET_VTABLE
@@ -42,7 +42,7 @@ struct dom_element_vtable _dom_element_vtable = {
DOM_ELEMENT_VTABLE
};
-static struct dom_element_protected_vtable element_protect_vtable = {
+static const struct dom_element_protected_vtable element_protect_vtable = {
{
DOM_NODE_PROTECT_VTABLE_ELEMENT
},
diff --git a/src/core/element.h b/src/core/element.h
index c89ddc0..fb946b7 100644
--- a/src/core/element.h
+++ b/src/core/element.h
@@ -238,6 +238,6 @@ dom_exception _dom_element_copy_internal(dom_element *old,
dom_exception _dom_element_get_id(struct dom_element *ele, dom_string **id);
-extern struct dom_element_vtable _dom_element_vtable;
+extern const struct dom_element_vtable _dom_element_vtable;
#endif
diff --git a/src/core/entity_ref.c b/src/core/entity_ref.c
index aa32111..bc6fbab 100644
--- a/src/core/entity_ref.c
+++ b/src/core/entity_ref.c
@@ -20,14 +20,14 @@ struct dom_entity_reference {
dom_node_internal base; /**< Base node */
};
-static struct dom_node_vtable er_vtable = {
+static const struct dom_node_vtable er_vtable = {
{
DOM_NODE_EVENT_TARGET_VTABLE
},
DOM_NODE_VTABLE
};
-static struct dom_node_protect_vtable er_protect_vtable = {
+static const struct dom_node_protect_vtable er_protect_vtable = {
DOM_ER_PROTECT_VTABLE
};
diff --git a/src/core/node.c b/src/core/node.c
index b471725..f8b8def 100644
--- a/src/core/node.c
+++ b/src/core/node.c
@@ -55,14 +55,14 @@ static inline dom_exception _dom_node_detach_range(dom_node_internal *first,
static inline void _dom_node_replace(dom_node_internal *old,
dom_node_internal *replacement);
-static struct dom_node_vtable node_vtable = {
+static const struct dom_node_vtable node_vtable = {
{
DOM_NODE_EVENT_TARGET_VTABLE
},
DOM_NODE_VTABLE
};
-static struct dom_node_protect_vtable node_protect_vtable = {
+static const struct dom_node_protect_vtable node_protect_vtable = {
DOM_NODE_PROTECT_VTABLE
};
diff --git a/src/core/node.h b/src/core/node.h
index 87f3cb3..36d0ec1 100644
--- a/src/core/node.h
+++ b/src/core/node.h
@@ -53,7 +53,7 @@ typedef struct dom_node_protect_vtable {
*/
struct dom_node_internal {
struct dom_node base; /**< The vtable base */
- void *vtable; /**< The protected vtable */
+ const void *vtable; /**< The protected vtable */
dom_string *name; /**< Node name (this is the local part
* of a QName in the cases where a
diff --git a/src/core/pi.c b/src/core/pi.c
index d12f109..3e69841 100644
--- a/src/core/pi.c
+++ b/src/core/pi.c
@@ -20,14 +20,14 @@ struct dom_processing_instruction {
dom_node_internal base; /**< Base node */
};
-static struct dom_node_vtable pi_vtable = {
+static const struct dom_node_vtable pi_vtable = {
{
DOM_NODE_EVENT_TARGET_VTABLE
},
DOM_NODE_VTABLE
};
-static struct dom_node_protect_vtable pi_protect_vtable = {
+static const struct dom_node_protect_vtable pi_protect_vtable = {
DOM_PI_PROTECT_VTABLE
};
/**
diff --git a/src/core/text.c b/src/core/text.c
index b73e86d..f63fabe 100644
--- a/src/core/text.c
+++ b/src/core/text.c
@@ -20,7 +20,7 @@
#include "utils/utils.h"
/* The virtual table for dom_text */
-struct dom_text_vtable text_vtable = {
+const struct dom_text_vtable text_vtable = {
{
{
{
@@ -33,7 +33,7 @@ struct dom_text_vtable text_vtable = {
DOM_TEXT_VTABLE
};
-static struct dom_node_protect_vtable text_protect_vtable = {
+static const struct dom_node_protect_vtable text_protect_vtable = {
DOM_TEXT_PROTECT_VTABLE
};
diff --git a/src/core/text.h b/src/core/text.h
index 26424ce..3f5739b 100644
--- a/src/core/text.h
+++ b/src/core/text.h
@@ -66,7 +66,7 @@ dom_exception _dom_text_copy(dom_node_internal *old, dom_node_internal **copy);
__dom_text_destroy, \
_dom_text_copy
-extern struct dom_text_vtable text_vtable;
+extern const struct dom_text_vtable text_vtable;
dom_exception _dom_text_copy_internal(dom_text *old, dom_text *new);
#define dom_text_copy_internal(o, n) \