From ae77b0dbe9474b80505de50c082374cd2b1250c8 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Mon, 26 Jul 2021 20:51:38 +0200 Subject: [PATCH] change: reduce splitter parameter --- discspan.c | 4 ++-- splitter.c | 8 ++++---- splitter.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/discspan.c b/discspan.c index 7bb1f70..e3d5547 100644 --- a/discspan.c +++ b/discspan.c @@ -12,7 +12,7 @@ extern void (*printEvent)(const char *output, unsigned long long splitgroesse); extern void useage(); extern file_size_t * read_input_file(); extern file_size_t * splitter(file_size_t *input, const char *output, - unsigned long long splitgroesse, int length); + unsigned long long splitgroesse); int struct_array_length = 0; unsigned long long split = 0; @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) int num = 1; while (struct_array_length > 0) { sprintf(outname, "%s%03d", output, num++); - fs = splitter(fs, outname, split, struct_array_length); + fs = splitter(fs, outname, split); } free(fs); diff --git a/splitter.c b/splitter.c index 98b60d3..f2eb235 100644 --- a/splitter.c +++ b/splitter.c @@ -26,18 +26,18 @@ void onPrintEvent(const char *output, unsigned long long splitgroesse) } file_size_t * splitter(file_size_t *input, const char *output, - unsigned long long splitgroesse, int length) + unsigned long long splitgroesse) { file_size_t *rest = (file_size_t *) - malloc(length * sizeof(file_size_t)); + malloc(struct_array_length * sizeof(file_size_t)); file_size_t *disc = (file_size_t *) - malloc(length * sizeof(file_size_t)); + malloc(struct_array_length * sizeof(file_size_t)); unsigned long long filesize = 0; int restcount = 0; int disccount = 0; - for (int i = 0; i < length; i++) { + for (int i = 0; i < struct_array_length; i++) { // ISO9660 filesystem overhead filesize = ceil(input[i].fsize / 2048.0) * 2048; diff --git a/splitter.h b/splitter.h index da7f3ae..77614a4 100644 --- a/splitter.h +++ b/splitter.h @@ -22,6 +22,6 @@ void (*printEvent)(const char *output, unsigned long long splitgroesse); * @return Restlaenge des neuen Arrays */ file_size_t * splitter(file_size_t *input, const char *output, - unsigned long long splitgroesse, int length); + unsigned long long splitgroesse); #endif -- 2.39.5