[parted-devel] Minor change: remove type-cast from ped_disk_type_register

Debarshi 'Rishi' Ray debarshi.ray at gmail.com
Fri Nov 2 09:35:07 UTC 2007


> Were the type-casts necessary?

diff --git a/libparted/disk.c b/libparted/disk.c
index e2e55c3..d8a85f4 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -68,9 +68,8 @@ ped_disk_type_register (PedDiskType* dis
        PED_ASSERT (disk_type->ops != NULL, return);
        PED_ASSERT (disk_type->name != NULL, return);

-       /* pretend that "next" isn't part of the struct :-) */
-       ((struct _PedDiskType*) disk_type)->next = disk_types;
-       disk_types = (struct _PedDiskType*) disk_type;
+        disk_type->next = disk_types;
+        disk_types =  disk_type;
 }

 void
diff --git a/libparted/filesys.c b/libparted/filesys.c
index 986f0ca..38d1f75 100644
--- a/libparted/filesys.c
+++ b/libparted/filesys.c
@@ -49,9 +49,8 @@ ped_file_system_type_register (PedFileSy
        PED_ASSERT (fs_type->ops != NULL, return);
        PED_ASSERT (fs_type->name != NULL, return);

-       /* pretend that "next" isn't part of the struct :-) */
-       ((struct _PedFileSystemType*) fs_type)->next = fs_types;
-       fs_types = (struct _PedFileSystemType*) fs_type;
+        fs_type->next = fs_types;
+        fs_types = fs_type;
 }

 void

Comments?

Happy hacking,
Debarshi
-- 
GPG key ID: 63D4A5A7
Key server: pgp.mit.edu



More information about the parted-devel mailing list