]> gitweb.hhaalo.de Git - discspan.git/commitdiff
fix: typdef of file_size_t struct
authorBastian Dehn <hhaalo@arcor.de>
Sun, 12 Jan 2020 14:57:21 +0000 (15:57 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 12 Jan 2020 14:57:21 +0000 (15:57 +0100)
discspan.c
discspan.h
readfile.c
readfile.h

index 2b30cd88b268022f74babb787633b627d2e79c56..6876f35fae62c65bb72c1c7918b9e6aae8c6e96c 100644 (file)
@@ -34,8 +34,8 @@ void printHumanReadSize(const char *output, unsigned long long splitgroesse)
 
 int cmpfunc(const void *filea, const void *fileb)
 {
-       unsigned long long a = ((const struct file_size*)filea)->fsize;
-       unsigned long long b = ((const struct file_size*)fileb)->fsize;
+       unsigned long long a = ((const file_size_t*)filea)->fsize;
+       unsigned long long b = ((const file_size_t*)fileb)->fsize;
 
        if (a < b)
                return 1;
@@ -59,11 +59,11 @@ int cmpfunc(const void *filea, const void *fileb)
  *
  * @return Restlaenge des neuen Arrays
  */
-int splitter(struct file_size *input, const char *output,
+int splitter(file_size_t *input, const char *output,
                unsigned long long splitgroesse, int length)
 {
-       struct file_size *rest = (struct file_size *)
-               malloc(length * sizeof(struct file_size));
+       file_size_t *rest = (file_size_t *)
+               malloc(length * sizeof(file_size_t));
 
        unsigned long long filesize = 0;
        int restcount = 0;
@@ -86,9 +86,9 @@ int splitter(struct file_size *input, const char *output,
        printHumanReadSize(output, splitgroesse);
 
        if (restcount > 0) {
-               memcpy(input, rest, length * sizeof(struct file_size));
-               input = (struct file_size *)
-                       realloc(input, restcount * sizeof(struct file_size));
+               memcpy(input, rest, length * sizeof(file_size_t));
+               input = (file_size_t *)
+                       realloc(input, restcount * sizeof(file_size_t));
        }
 
        free(rest);
@@ -140,9 +140,9 @@ int main(int argc, char *argv[])
        }
 
        readArgument(argc, argv);
-       struct file_size *fs = read_input_file(input);
+       file_size_t *fs = read_input_file(input);
 
-       qsort(fs, (struct_array_length + 1), sizeof(struct file_size), cmpfunc);
+       qsort(fs, (struct_array_length + 1), sizeof(file_size_t), cmpfunc);
 
        char outname[strlen(output) + 3];
        int num = 1;
index fdcaf7982b3d84a4bd1ded807ab3d8b16d2df571..16142764acc378ce0cfab9f60ea59dcc1fd216c9 100644 (file)
@@ -1,9 +1,9 @@
 #ifndef _DISCSPAN_H
 #define _DISCSPAN_H
 
-typedef struct file_size {
+typedef struct {
        char name[255];
        long long unsigned fsize;
-} file_size;
+} file_size_t;
 
 #endif
index 66573a7e73d1c9900b41e8378b03c3dec71550d3..c857a72bd1995b08701f50e296997bacc6c1067c 100644 (file)
@@ -36,7 +36,7 @@ int get_array_length(FILE *in)
  *
  * @return Arraylaenge
  */
-int fill_array_from_file(FILE *in, struct file_size *fs,
+int fill_array_from_file(FILE *in, file_size_t *fs,
                const unsigned long long split)
 {
        FILE *ignore = NULL;
@@ -74,17 +74,17 @@ int fill_array_from_file(FILE *in, struct file_size *fs,
  *
  * @return file_size struct array
  */
-file_size * read_input_file(const char *input)
+file_size_t * read_input_file(const char *input)
 {
        FILE *in = fopen(input, "r");
 
        struct_array_length = get_array_length(in);
-       struct file_size *fs = (struct file_size *)
-               malloc(struct_array_length * sizeof(struct file_size));
+       file_size_t *fs = (file_size_t *)
+               malloc(struct_array_length * sizeof(file_size_t));
 
        struct_array_length = fill_array_from_file(in, fs, split);
-       fs = (struct file_size *)
-               realloc(fs, struct_array_length * sizeof(struct file_size));
+       fs = (file_size_t *)
+               realloc(fs, struct_array_length * sizeof(file_size_t));
 
        fclose(in);
 
index ec8dd5d099b9f9eb51064048d14eaed79e66fe47..5fb4e08d025cd6cbbb9fcb35cd5600e84220f25d 100644 (file)
@@ -5,6 +5,6 @@
 
 #include "discspan.h"
 
-file_size * read_input_file(const char *input);
+file_size_t * read_input_file(const char *input);
 
 #endif