]> gitweb.hhaalo.de Git - discspan.git/commitdiff
change: init values without malloc
authorBastian Dehn <hhaalo@arcor.de>
Sat, 14 Aug 2021 17:31:03 +0000 (19:31 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 14 Aug 2021 17:31:03 +0000 (19:31 +0200)
libs/spandisc/src/splitter.c

index 54f48a30700649012ce946788035df906cfbaff5..4ad48ec0b65fc92eb747ebaac1923a7f31ac0fc9 100644 (file)
@@ -13,8 +13,7 @@ medium_t init_empty_medium(medium_t srcdata)
        empty.nr = srcdata.nr;
        empty.freespace = srcdata.freespace;
        empty.length = 0;
-       empty.filearray = (file_size_t *)
-               malloc(1 * sizeof(file_size_t));
+       empty.filearray = NULL;
        return empty;
 }
 
@@ -94,15 +93,13 @@ medium_t ignore(medium_t *srcdata)
 
 collection_t split_all(medium_t *srcdata)
 {
-       collection_t col;
-       col.length = 0;
-       col.disc = NULL;
+       collection_t col = { 0, NULL };
 
-       medium_t ignoredisc;
+       medium_t ignoredisc = { 0, 0, 0, NULL };
        ignoredisc = ignore(srcdata);
        ignoredisc.freespace = 0;
        if (ignoredisc.length > 0) {
-               col.disc = (medium_t *)malloc(sizeof(medium_t));
+               col.disc = (medium_t *) malloc(sizeof(medium_t));
                col.disc[col.length] = ignoredisc;
                col.length++;
        }