From affa5bfd13813783d59bffafb55045ce1c7fb9a0 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sun, 24 Dec 2017 11:28:48 +0100 Subject: [PATCH] fix: line length 80 characters --- discspan.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/discspan.c b/discspan.c index f8bd8bb..f16cb35 100644 --- a/discspan.c +++ b/discspan.c @@ -34,8 +34,6 @@ void printHumanReadSize(const char *output, unsigned long long int splitgroesse) splitgroesse, humanread, einheit); } - - int cmpfunc(const void *filea, const void *fileb) { long long unsigned int a = ((const struct file_size*)filea)->fsize; @@ -115,7 +113,9 @@ void usage() int splitter(struct file_size *input, const char *output, unsigned long long splitgroesse, int length) { - struct file_size *rest = (struct file_size *)malloc(length * sizeof(struct file_size)); + struct file_size *rest = (struct file_size *) + malloc(length * sizeof(struct file_size)); + unsigned long long filesize = 0; char *filename; int restcount = 0; @@ -193,10 +193,15 @@ int main(int argc, char *argv[]) // Liest die Quelldatei in den Ram FILE *in = fopen(input, "r"); + int s_length = get_array_length(in); - struct file_size *fs = (struct file_size *)malloc((s_length + 1) * sizeof(struct file_size)); + struct file_size *fs = (struct file_size *) + malloc(s_length * sizeof(struct file_size)); + s_length = fill_array_from_file(in, fs, split); - fs = (struct file_size *)realloc(fs, s_length * sizeof(struct file_size)); + fs = (struct file_size *) + realloc(fs, s_length * sizeof(struct file_size)); + fclose(in); // sortieren @@ -207,7 +212,8 @@ int main(int argc, char *argv[]) while(s_length > 0) { sprintf(outname, "%s%03d", output, num++); s_length = splitter(fs, outname, split, s_length); - fs = (struct file_size *)realloc(fs, s_length * sizeof(struct file_size)); + fs = (struct file_size *) + realloc(fs, s_length * sizeof(struct file_size)); } free(fs); -- 2.39.5