aboutsummaryrefslogtreecommitdiffstats
path: root/src/content-parser.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2015-05-27 04:00:15 -0300
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2015-05-27 04:00:15 -0300
commit9385055b8bfc6a8eaa7f543b0cd42373c4751ba2 (patch)
treed3a7f306602a97d8a8deddb9c9822dab04297331 /src/content-parser.c
parent3cd628f31ff383114e21349958fd19f45fe2a8c0 (diff)
downloadblogc-9385055b8bfc6a8eaa7f543b0cd42373c4751ba2.tar.gz
blogc-9385055b8bfc6a8eaa7f543b0cd42373c4751ba2.tar.bz2
blogc-9385055b8bfc6a8eaa7f543b0cd42373c4751ba2.zip
content-parser: random fixes and more tests for inline content parser
Diffstat (limited to 'src/content-parser.c')
-rw-r--r--src/content-parser.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/content-parser.c b/src/content-parser.c
index 041e96d..ab3d9c3 100644
--- a/src/content-parser.c
+++ b/src/content-parser.c
@@ -249,7 +249,8 @@ blogc_content_parse_inline(const char *src)
spaces++;
b_string_append_c(rv, c);
}
- break;
+ if (!is_last)
+ break;
case '\n':
case '\r':
@@ -258,7 +259,7 @@ blogc_content_parse_inline(const char *src)
b_string_append(rv, "<br />\n");
spaces = 0;
}
- else
+ else if (c == '\n' || c == '\r')
b_string_append_c(rv, c);
}
break;
@@ -301,6 +302,10 @@ blogc_content_parse_inline(const char *src)
current++;
}
+ // FIXME: do not just free this leftover memory
+ free(tmp);
+ free(tmp2);
+
return b_string_free(rv, false);
}