aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-03-15 19:49:40 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-03-17 13:01:40 +0100
commita3afdbb58800ea2b559585e321d4a18ed33c4655 (patch)
tree10a2b69fa4b1b971dcd9c655ea9cef6ec6c0849a
parentfb0f81a1d8b5369842269fa1bdb9ad8d52882491 (diff)
wgtpkg-unit: fix last empty continuation
Change-Id: Id0a9581032add095756141a4373b34cee3cd6f80 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/wgtpkg-unit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wgtpkg-unit.c b/src/wgtpkg-unit.c
index 48cf3bb..e2813ba 100644
--- a/src/wgtpkg-unit.c
+++ b/src/wgtpkg-unit.c
@@ -116,12 +116,13 @@ static size_t pack(char *text, char purge)
char cont; /* flag telling whether the line continues the previous one */
char nextcont; /* flag telling whether the line will continues the next one */
- cont = 0;
+ nextcont = 0;
c = *(write = read = text);
/* iteration over lines */
while (c) {
/* computes emit, nextcont, emit and start for the current line */
+ cont = nextcont;
emit = nextcont = 0;
start = NULL;
begin = read;
@@ -140,7 +141,7 @@ static size_t pack(char *text, char purge)
if (c)
c = *++read;
/* emit the line if not empty */
- if (emit) {
+ if (emit || (cont && !nextcont)) {
/* removes the blanks on the left of not continuing lines */
if (!cont && start)
begin = start;
@@ -155,7 +156,6 @@ static size_t pack(char *text, char purge)
*write++ = *begin++;
}
}
- cont = nextcont;
}
*write = 0;
return (size_t)(write - text);