From 95e1696e37cf1bae3239acf41d351951364f11ef Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sun, 31 Jan 2016 01:47:13 +0100 Subject: content-parser: removed goto jumps --- src/content-parser.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/content-parser.c b/src/content-parser.c index 1a929e2..ccb96ef 100644 --- a/src/content-parser.c +++ b/src/content-parser.c @@ -439,8 +439,6 @@ blogc_content_parse(const char *src, size_t *end_excerpt) size_t eend = 0; size_t real_end = 0; - bool no_jump = false; - unsigned int header_level = 0; char *prefix = NULL; size_t prefix_len = 0; @@ -655,7 +653,7 @@ blogc_content_parse(const char *src, size_t *end_excerpt) if (is_last) { free(tmp); tmp = NULL; - goto para; + continue; } } free(tmp); @@ -719,7 +717,7 @@ blogc_content_parse(const char *src, size_t *end_excerpt) free(tmp); tmp = NULL; if (is_last) - goto para; + continue; break; } free(tmp); @@ -756,9 +754,9 @@ blogc_content_parse(const char *src, size_t *end_excerpt) case CONTENT_UNORDERED_LIST_OR_HORIZONTAL_RULE: if (c == d) { - if (is_last) - goto hr; state = CONTENT_HORIZONTAL_RULE; + if (is_last) + continue; break; } if (c == ' ' || c == '\t') @@ -771,7 +769,6 @@ blogc_content_parse(const char *src, size_t *end_excerpt) if (c == d && !is_last) { break; } -hr: if (c == '\n' || c == '\r' || is_last) { b_string_append_printf(rv, "
%s", line_ending); state = CONTENT_START_LINE; @@ -823,7 +820,7 @@ hr: b_slist_free_full(lines2, free); lines = NULL; if (is_last) - goto para; + continue; break; } free(tmp); @@ -882,7 +879,7 @@ hr: } state = CONTENT_PARAGRAPH; if (is_last) - goto para; + continue; break; case CONTENT_ORDERED_LIST_SPACE: @@ -934,7 +931,7 @@ hr: b_slist_free_full(lines2, free); lines = NULL; if (is_last) - goto para; + continue; break; } free(tmp); @@ -994,15 +991,7 @@ hr: break; case CONTENT_PARAGRAPH_END: - no_jump = true; -para: if (c == '\n' || c == '\r' || is_last) { - if (!no_jump && is_last) { - if (c == '\n' || c == '\r') - end = src_len - 1; - else - end = src_len; - } tmp = b_strndup(src + start, end - start); parsed = blogc_content_parse_inline(tmp); b_string_append_printf(rv, "

%s

%s", parsed, -- cgit v1.2.3-18-g5258