From 6530b888d7adb7e2ac0d3f1d47c9d58bd5c59451 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Thu, 22 Oct 2015 03:58:17 -0200 Subject: content-parser: replace useless array with boolean --- src/content-parser.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') 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; } } -- cgit v1.2.3-18-g5258