summaryrefslogtreecommitdiff
path: root/src/core/string.c
diff options
context:
space:
mode:
authorBo Yang <struggleyb.nku@gmail.com>2009-08-13 09:33:24 +0000
committerBo Yang <struggleyb.nku@gmail.com>2009-08-13 09:33:24 +0000
commit13fadb12fb400818e0ccb4c38b3bfce70ccfdad2 (patch)
tree19c55b39d97567a37b88b49aaaac13b21b9f24ee /src/core/string.c
parentbf6bc398bd40e39a016725550f5b8446a01ee2d1 (diff)
downloadlibdom-13fadb12fb400818e0ccb4c38b3bfce70ccfdad2.tar.gz
libdom-13fadb12fb400818e0ccb4c38b3bfce70ccfdad2.tar.bz2
Merge the Events module (branches/struggleyb/libdom-events) back to trunk. :)
svn path=/trunk/dom/; revision=9236
Diffstat (limited to 'src/core/string.c')
-rw-r--r--src/core/string.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/core/string.c b/src/core/string.c
index 081e03d..7442c66 100644
--- a/src/core/string.c
+++ b/src/core/string.c
@@ -56,7 +56,8 @@ static struct dom_string empty_string = {
*/
void dom_string_ref(struct dom_string *str)
{
- str->refcnt++;
+ if (str != NULL)
+ str->refcnt++;
}
/**
@@ -963,3 +964,26 @@ int _dom_lwc_string_compare_raw(struct lwc_string_s *s1,
return memcmp(rs1, rs2, len);
}
+/**
+ * Get the raw character data of the dom_string.
+ *
+ * \param str The dom_string object
+ * \return The C string pointer
+ *
+ * @note: This function is just provided for the convenience of accessing the
+ * raw C string character, no change on the result string is allowed.
+ */
+char *_dom_string_data(struct dom_string *str)
+{
+ return (char *) str->ptr;
+}
+
+/* Get the string length of this dom_string
+ *
+ * \param str The dom_string object
+ */
+size_t _dom_string_length(struct dom_string *str)
+{
+ return str->len;
+}
+