aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-07-02 17:42:37 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-02 17:42:37 +0200
commit2b1a4ac7ad5743400fa875a91ee6869fcd94a9ed (patch)
tree136f282c5fcd53e37d053f39f97acd607529380b /tests
parent78f204d79c9ed61815a7eb206f2c1a4f4df289a0 (diff)
Return non-0 value from callback to cancel parsing (and return the value in html_parser_parse)
Diffstat (limited to 'tests')
-rw-r--r--tests/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/main.c b/tests/main.c
index de37c9a..b3b6d5c 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -20,7 +20,7 @@ char* file_get_content(const char *path, long *filesize) {
return data;
}
-static void html_parse_callback(HtmlParser *html_parser, HtmlParseType parse_type, void *userdata_any) {
+static int html_parse_callback(HtmlParser *html_parser, HtmlParseType parse_type, void *userdata_any) {
switch(parse_type) {
case HTML_PARSE_TAG_START:
printf("tag start: %.*s\n", (int)html_parser->tag_name.size, html_parser->tag_name.data);
@@ -29,6 +29,7 @@ static void html_parse_callback(HtmlParser *html_parser, HtmlParseType parse_typ
printf("tag end: %.*s\n", (int)html_parser->tag_name.size, html_parser->tag_name.data);
break;
}
+ return 0;
}
int main() {