]> gitweb.hhaalo.de Git - discspan.git/commitdiff
fix: bugfix revert commit: c3a4a8c
authorBastian Dehn <hhaalo@arcor.de>
Sun, 17 Dec 2017 21:15:10 +0000 (22:15 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 17 Dec 2017 21:15:10 +0000 (22:15 +0100)
rervert: change: array with realloc

discspan.c

index 33076392da71e4ef77db90e00af70ba225832873..c45f04aec5793af8bc62ed36b06aa9f8b1a9442c 100644 (file)
@@ -121,8 +121,7 @@ void filesize_sort(const char *input, const char *output,
        fseek(in, 0L, SEEK_SET);
 
        // struct Array with Dateienanzahl
-       struct file_size *fs = NULL;
-       fs = (struct file_size *)malloc((lines - 1) * sizeof(struct file_size));
+       struct file_size fs[lines -1];
        lines = 0;
 
        while(fscanf(in, "%[^\n]\n", pfad) == 1) {
@@ -144,9 +143,6 @@ void filesize_sort(const char *input, const char *output,
                }
        }
 
-       fs = (struct file_size *)realloc(fs,
-                       (lines + 1) * sizeof(struct file_size));
-
        // sortiere das array fs mit stucts
        qsort(fs, lines, sizeof(struct file_size), cmpfunc);