aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-05-25 23:42:40 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 06:55:04 +0200
commit5f968f9b788ff997c21d5463394db2a975d55ed2 (patch)
treeaebf1728893b9497a1b172cedce6a12106b202a1 /src
parente7365234460fc9fb949a6a9745b7041b04b6a6a4 (diff)
Fix tests etc
Diffstat (limited to 'src')
-rw-r--r--src/HtmlSearch.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/HtmlSearch.c b/src/HtmlSearch.c
index dcbb8f2..abb04d6 100644
--- a/src/HtmlSearch.c
+++ b/src/HtmlSearch.c
@@ -75,28 +75,19 @@ const char* quickmedia_html_node_get_attribute_value(QuickMediaHtmlNode *self, c
return tidyAttrValue(attr);
}
-QuickMediaStringView quickmedia_html_node_get_text(QuickMediaHtmlNode *self) {
- QuickMediaStringView string_view;
- string_view.data = NULL;
- string_view.size = 0;
-
- if(self->text) {
- string_view.data = (const char*)((TidyBuffer*)self->text)->bp;
- string_view.size = ((TidyBuffer*)self->text)->size;
- return string_view;
- }
+const char* quickmedia_html_node_get_text(QuickMediaHtmlNode *self) {
+ if(self->text)
+ return (const char*)((TidyBuffer*)self->text)->bp;
TidyNode child_node = tidyGetChild(self->node);
if(tidyNodeGetType(child_node) != TidyNode_Text)
- return string_view;
+ return NULL;
self->text = malloc(sizeof(TidyBuffer));
tidyBufInit(self->text);
tidyNodeGetText(self->doc, child_node, self->text);
- string_view.data = (const char*)((TidyBuffer*)self->text)->bp;
- string_view.size = ((TidyBuffer*)self->text)->size;
- return string_view;
+ return (const char*)((TidyBuffer*)self->text)->bp;
}
static int quickmedia_html_find_nodes(QuickMediaHtmlSearch *self, QuickMediaNodeSearch *search_data, QuickMediaHtmlSearchResultCallback result_callback, void *userdata) {