]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: reorder function
authorKarel Zak <kzak@redhat.com>
Thu, 2 Sep 2021 12:00:44 +0000 (14:00 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Oct 2021 09:01:54 +0000 (11:01 +0200)
Keep free_() after new_().

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsfd.c

index 40e0c431d1773d3ee86a5062c450b5b3c68a331e..b403a472caa3cb2b57e6a12429868370504d0129 100644 (file)
@@ -283,6 +283,18 @@ static struct file *new_file(
        return file;
 }
 
+static void free_file(struct file *file)
+{
+       const struct file_class *class = file->class;
+
+       while (class) {
+               if (class->free_content)
+                       class->free_content(file);
+               class = class->super;
+       }
+       free(file);
+}
+
 
 static struct proc *new_prococess(pid_t pid, struct proc * leader)
 {
@@ -295,16 +307,12 @@ static struct proc *new_prococess(pid_t pid, struct proc * leader)
        return proc;
 }
 
-static void free_file(struct file *file)
+static void free_proc(struct proc *proc)
 {
-       const struct file_class *class = file->class;
+       list_free(&proc->files, struct file, files, free_file);
 
-       while (class) {
-               if (class->free_content)
-                       class->free_content(file);
-               class = class->super;
-       }
-       free(file);
+       free(proc->command);
+       free(proc);
 }
 
 static struct nodev* new_nodev(unsigned long minor, const char *filesystem)
@@ -336,13 +344,6 @@ static void finalize_nodevs(void)
                list_free(&nodev_table.tables[i], struct nodev, nodevs, free_nodev);
 }
 
-static void free_proc(struct proc *proc)
-{
-       list_free(&proc->files, struct file, files, free_file);
-
-       free(proc->command);
-       free(proc);
-}
 
 static void enqueue_proc(struct list_head *procs, struct proc * proc)
 {