From 8d9b06e586f28e8d46e78edee58fc3e875074082 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sat, 23 Dec 2017 21:50:10 +0100 Subject: [PATCH] fix: count line bug --- discspan.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/discspan.c b/discspan.c index f3e5239..9bea789 100644 --- a/discspan.c +++ b/discspan.c @@ -89,6 +89,7 @@ unsigned long fill_array_from_file(FILE *in, struct file_size *fs, fprintf(ignore, "%s\n", pfad); } } + lines--; fs = (struct file_size *)realloc(fs, lines * sizeof(struct file_size)); @@ -125,12 +126,8 @@ int splitter(struct file_size *input, const char *output, for(int i = 0; i <= length; i++) { // filesize inklusive overhead if(splitgroesse >= input[i].fsize) { - if(i < length) { - splitgroesse -= input[i].fsize; - fprintf(out, "%s\n", input[i].name); - } else { - fprintf(out, "%s", input[i].name); - } + splitgroesse -= input[i].fsize; + fprintf(out, "%s\n", input[i].name); } else { rest[restcount++] = input[i]; } -- 2.39.5