From cd786ced0f04d9383cde1c451f0bab18135072bd Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 3 Feb 2020 22:34:58 +0100 Subject: Make c89 compliant --- project.conf | 3 +++ src/HtmlParser.c | 10 +++++++--- 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); -- cgit v1.2.3