aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-01-31 01:47:13 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-01-31 02:12:13 +0100
commit95e1696e37cf1bae3239acf41d351951364f11ef (patch)
tree6b24986b87c9c067d40ae9a14376a2b8ba1722a4
parent3b0ea0a4908f1702308354ec7cbd8db5c80f87ee (diff)
downloadblogc-95e1696e37cf1bae3239acf41d351951364f11ef.tar.gz
blogc-95e1696e37cf1bae3239acf41d351951364f11ef.tar.bz2
blogc-95e1696e37cf1bae3239acf41d351951364f11ef.zip
content-parser: removed goto jumps
-rw-r--r--src/content-parser.c25
1 files 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, "<hr />%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, "<p>%s</p>%s", parsed,