aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/HtmlParser.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/HtmlParser.h b/include/HtmlParser.h
index e6f0c3b..a7cdb4f 100644
--- a/include/HtmlParser.h
+++ b/include/HtmlParser.h
@@ -27,7 +27,8 @@ typedef enum{
HTML_PARSE_JAVASCRIPT_CODE
} HtmlParseType;
-typedef void (*HtmlParseCallback)(HtmlParser *html_parser, HtmlParseType parse_type, void *userdata);
+/* Return 0 to continue */
+typedef int (*HtmlParseCallback)(HtmlParser *html_parser, HtmlParseType parse_type, void *userdata);
#define UNCLOSED_TAGS_SIZE 2048
@@ -53,8 +54,11 @@ struct HtmlParser {
HtmlStringView unclosed_tags[UNCLOSED_TAGS_SIZE];
};
-/* Note: HTML_PARSE_TAG_START is guaranteed to be called for a tag before HTML_PARSE_TAG_END */
-void html_parser_parse(const char *html_source, size_t len, HtmlParseCallback parse_callback, void *userdata);
+/*
+ Returns the value returned from |parse_callback|. 0 meaning success.
+ Note: HTML_PARSE_TAG_START is guaranteed to be called for a tag before HTML_PARSE_TAG_END
+*/
+int html_parser_parse(const char *html_source, size_t len, HtmlParseCallback parse_callback, void *userdata);
#ifdef __cplusplus
}