aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-02-03 22:34:58 +0100
committerdec05eba <dec05eba@protonmail.com>2020-02-03 22:34:58 +0100
commitcd786ced0f04d9383cde1c451f0bab18135072bd (patch)
tree12b2c40014bcbb76d8c3251d5beb150d4f45529b
parentb5ad3f1202f247ba508cdf6e302ca57fead96439 (diff)
Make c89 compliant
-rw-r--r--project.conf3
-rw-r--r--src/HtmlParser.c10
2 files changed, 10 insertions, 3 deletions
diff --git a/project.conf b/project.conf
index beb295a..c83623b 100644
--- a/project.conf
+++ b/project.conf
@@ -4,6 +4,9 @@ type = "static"
version = "0.1.0"
platforms = ["any"]
+[lang.c]
+version = "c89"
+
[config]
expose_include_dirs = ["include"]
error_on_warning = "true"
diff --git a/src/HtmlParser.c b/src/HtmlParser.c
index b4beee4..f300b62 100644
--- a/src/HtmlParser.c
+++ b/src/HtmlParser.c
@@ -378,6 +378,9 @@ static void html_parser_parse_tag_end(HtmlParser *self) {
return;
} else if(!tag_name_found && is_identifier_char(c)) {
HtmlStringView tag_end_name;
+ ssize_t found_start_tag_index;
+ ssize_t i;
+
tag_end_name.data = self->source + self->offset;
html_parser_advance_char(self);
for(;;) {
@@ -397,8 +400,8 @@ static void html_parser_parse_tag_end(HtmlParser *self) {
continue;
}
- ssize_t found_start_tag_index = -1;
- for(ssize_t i = self->unclosed_tags_offset - 1; i >= 0; --i) {
+ found_start_tag_index = -1;
+ for(i = self->unclosed_tags_offset - 1; i >= 0; --i) {
if(string_view_equals(&self->unclosed_tags[i], &tag_end_name)) {
found_start_tag_index = i;
break;
@@ -422,6 +425,8 @@ static void html_parser_parse_tag_end(HtmlParser *self) {
}
void html_parser_parse(HtmlParser *self) {
+ HtmlStringView top_unclosed_tag;
+
html_parser_reset(self);
for(;;) {
char c = html_parser_next_char(self);
@@ -449,7 +454,6 @@ void html_parser_parse(HtmlParser *self) {
}
}
- 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);