summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-12-13 20:16:52 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-12-13 20:16:52 +0000
commit1b95fec601a3d006ba6b99e1dea3f61c3c8318fc (patch)
tree1a0c3a78afe1db919ff6b4c56a6c3f2e01d03607 /src/utils
parente3372335ec1628e1d6ef1a4fd63b11bb47f2e0e6 (diff)
downloadlibcss-1b95fec601a3d006ba6b99e1dea3f61c3c8318fc.tar.gz
libcss-1b95fec601a3d006ba6b99e1dea3f61c3c8318fc.tar.bz2
Various changes which modify API and ABI:
- Remove client allocation function. - Change node_classes callback not to yield array ownership to libcss. - Node bloom filters now built by, during selection libcss. - Added selection callbacks to get and set data on document nodes. Test suite, example, and documentation updated to match.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/utils.c16
-rw-r--r--src/utils/utils.h8
2 files changed, 22 insertions, 2 deletions
diff --git a/src/utils/utils.c b/src/utils/utils.c
index 1745ea0..1899b23 100644
--- a/src/utils/utils.c
+++ b/src/utils/utils.c
@@ -130,3 +130,19 @@ css_fixed css__number_from_string(const uint8_t *data, size_t len,
return (intpart << 10) | fracpart;
}
+
+/* Allocator to pass to libparserutils */
+void *css_alloc(void *data, size_t len, void *pw)
+{
+ UNUSED(pw);
+
+ if (data == NULL) {
+ return (len > 0) ? malloc(len) : NULL;
+ }
+ if (len == 0) {
+ free(data);
+ return NULL;
+ }
+ return realloc(data, len);
+}
+
diff --git a/src/utils/utils.h b/src/utils/utils.h
index 1f7ed8c..3f7fcd0 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -62,8 +62,7 @@ static inline uint32_t charToHex(uint8_t c)
return c;
}
-static inline css_error
-css_error_from_lwc_error(lwc_error err)
+static inline css_error css_error_from_lwc_error(lwc_error err)
{
switch (err) {
case lwc_error_ok:
@@ -78,4 +77,9 @@ css_error_from_lwc_error(lwc_error err)
return CSS_INVALID;
}
+
+/* Allocator to pass to libparserutils */
+#define CSS_ALLOC_PW NULL
+void *css_alloc(void *data, size_t len, void *pw);
+
#endif