diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-05-27 04:00:15 -0300 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-05-27 04:00:15 -0300 |
commit | 9385055b8bfc6a8eaa7f543b0cd42373c4751ba2 (patch) | |
tree | d3a7f306602a97d8a8deddb9c9822dab04297331 /src | |
parent | 3cd628f31ff383114e21349958fd19f45fe2a8c0 (diff) | |
download | blogc-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')
-rw-r--r-- | src/content-parser.c | 9 |
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); } |