aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2015-10-22 03:58:17 -0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2015-10-22 03:58:17 -0200
commit6530b888d7adb7e2ac0d3f1d47c9d58bd5c59451 (patch)
tree08f373a65034734c23b8e9a36fffec9f3d21fdc3 /src
parent7f5e2066469ac96de3afac1bd57726c6e33dd848 (diff)
downloadblogc-6530b888d7adb7e2ac0d3f1d47c9d58bd5c59451.tar.gz
blogc-6530b888d7adb7e2ac0d3f1d47c9d58bd5c59451.tar.bz2
blogc-6530b888d7adb7e2ac0d3f1d47c9d58bd5c59451.zip
content-parser: replace useless array with boolean
Diffstat (limited to 'src')
-rw-r--r--src/content-parser.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/content-parser.c b/src/content-parser.c
index e8d3143..ab432a4 100644
--- a/src/content-parser.c
+++ b/src/content-parser.c
@@ -417,7 +417,7 @@ blogc_content_parse(const char *src, size_t *end_excerpt)
// unlikely case when we need to print some line ending before evaluating
// the "real" value.
char line_ending[3] = "\n";
- char l[2] = {0, 0};
+ bool line_ending_found = false;
char d = '\0';
@@ -438,22 +438,21 @@ blogc_content_parse(const char *src, size_t *end_excerpt)
if ((c == '\n' && src[current + 1] == '\r') ||
(c == '\r' && src[current + 1] == '\n'))
{
- if (l[0] == 0) {
- l[0] = c;
- l[1] = src[current + 1];
+ if (!line_ending_found) {
line_ending[0] = c;
line_ending[1] = src[current + 1];
line_ending[2] = '\0';
+ line_ending_found = true;
}
real_end = current;
c = src[++current];
is_last = current == src_len - 1;
}
}
- if (l[0] == 0) {
- l[0] = c;
+ if (!line_ending_found) {
line_ending[0] = c;
line_ending[1] = '\0';
+ line_ending_found = true;
}
}