aboutsummaryrefslogtreecommitdiff
path: root/src/HtmlParser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/HtmlParser.c')
-rw-r--r--src/HtmlParser.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/HtmlParser.c b/src/HtmlParser.c
index a1b62cd..2e52555 100644
--- a/src/HtmlParser.c
+++ b/src/HtmlParser.c
@@ -3,29 +3,29 @@
#include <string.h>
#include <assert.h>
-static StringView void_tags[] = {
- {.data = "area", .size = 4},
- {.data = "base", .size = 4},
- {.data = "br", .size = 2},
- {.data = "col", .size = 3},
- {.data = "command", .size = 7},
- {.data = "embed", .size = 5},
- {.data = "hr", .size = 2},
- {.data = "img", .size = 3},
- {.data = "input", .size = 5},
- {.data = "keygen", .size = 6},
- {.data = "link", .size = 4},
- {.data = "meta", .size = 4},
- {.data = "param", .size = 5},
- {.data = "source", .size = 6},
- {.data = "track", .size = 5},
- {.data = "wbr", .size = 3},
- {.data = NULL, .size = 0}
+static HtmlStringView void_tags[] = {
+ {"area", 4},
+ {"base", 4},
+ {"br", 2},
+ {"col", 3},
+ {"command", 7},
+ {"embed", 5},
+ {"hr", 2},
+ {"img", 3},
+ {"input", 5},
+ {"keygen", 6},
+ {"link", 4},
+ {"meta", 4},
+ {"param", 5},
+ {"source", 6},
+ {"track", 5},
+ {"wbr", 3},
+ {NULL, 0}
};
-static StringView script_tag = {.data = "script", .size = 6};
+static HtmlStringView script_tag = {"script", 6};
-static int string_view_equals(StringView *self, StringView *other) {
+static int string_view_equals(HtmlStringView *self, HtmlStringView *other) {
return self->size == other->size && memcmp(self->data, other->data, self->size) == 0;
}
@@ -68,8 +68,8 @@ static void strip(const char *str, size_t size, const char **output_str, size_t
rstrip(*output_str, *output_size, output_size, strip_filter_func);
}
-static int is_void_tag(StringView *tag_name) {
- StringView *tag_iter = &void_tags[0];
+static int is_void_tag(HtmlStringView *tag_name) {
+ HtmlStringView *tag_iter = &void_tags[0];
/* !DOCTYPE, !--, etc.... */
if(tag_name->size > 0 && tag_name->data[0] == '!')
return 1;
@@ -160,7 +160,7 @@ static void html_parser_try_pop_unclosed_tag(HtmlParser *self) {
--self->unclosed_tags_offset;
}
-static int html_parser_try_get_top_unclosed_tag(HtmlParser *self, StringView *result) {
+static int html_parser_try_get_top_unclosed_tag(HtmlParser *self, HtmlStringView *result) {
if(self->unclosed_tags_offset > 0) {
*result = self->unclosed_tags[self->unclosed_tags_offset - 1];
return 1;
@@ -304,7 +304,7 @@ static void html_parser_parse_tag_start(HtmlParser *self) {
return;
}
} else if(is_identifier_char(c)) {
- StringView identifier;
+ HtmlStringView identifier;
identifier.data = self->source + self->offset - 1;
for(;;) {
c = html_parser_peek_char(self);
@@ -361,7 +361,7 @@ static void html_parser_parse_tag_end(HtmlParser *self) {
html_parser_advance_char(self);
return;
} else if(!tag_name_found && is_identifier_char(c)) {
- StringView tag_end_name;
+ HtmlStringView tag_end_name;
tag_end_name.data = self->source + self->offset;
html_parser_advance_char(self);
for(;;) {
@@ -380,7 +380,7 @@ static void html_parser_parse_tag_end(HtmlParser *self) {
continue;
}
- StringView top_unclosed_tag;
+ HtmlStringView top_unclosed_tag;
while(html_parser_try_get_top_unclosed_tag(self, &top_unclosed_tag)) {
self->tag_name = top_unclosed_tag;
self->parse_callback(self, HTML_PARSE_TAG_END, self->callback_userdata);
@@ -425,7 +425,7 @@ void html_parser_parse(HtmlParser *self) {
}
}
- StringView top_unclosed_tag;
+ HtmlStringView top_unclosed_tag;
while(html_parser_try_get_top_unclosed_tag(self, &top_unclosed_tag)) {
self->tag_name = top_unclosed_tag;
self->parse_callback(self, HTML_PARSE_TAG_END, self->callback_userdata);