From c4a8b9d94afb889fc90f4a855d55b0a1716c57b2 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Sat, 11 Nov 2006 01:32:58 +0000 Subject: Changes done on darcs repository suitable for 1.8 release: Fri Nov 10 23:19:15 BRST 2006 Otavio Salvador * Code clean-up on registering and unregistering of disks * libparted/disk.c (ped_register_disk_type, ped_unregister_disk_type): Clean-up. Patch sent by Debarshi 'Rishi' Ray . Fri Nov 10 23:14:58 BRST 2006 Otavio Salvador * Fix filesystem unregistering * libparted/filesys.c (ped_file_system_type_unregister): Handle instances where fs_types == NULL and the given fs_type is not in the list of registered file-system types. Some code clean-up. Patch sent by Debarshi 'Rishi' Ray . git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@891 2d424fd7-7fe2-0310-af74-8bc65edeb173 --- libparted/filesys.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'libparted/filesys.c') diff --git a/libparted/filesys.c b/libparted/filesys.c index cf33f96..04f551c 100644 --- a/libparted/filesys.c +++ b/libparted/filesys.c @@ -62,18 +62,16 @@ ped_file_system_type_unregister (PedFileSystemType* fs_type) PedFileSystemType* walk; PedFileSystemType* last = NULL; + PED_ASSERT (fs_types != NULL, return); PED_ASSERT (fs_type != NULL, return); - for (walk = fs_types; walk != fs_type; walk = walk->next) { - if (!walk) return; - last = walk; - } + for (walk = fs_types; walk && walk != fs_type; last = walk, walk = walk->next); - if (last) { + PED_ASSERT (walk != NULL, return); + if (last) ((struct _PedFileSystemType*) last)->next = fs_type->next; - } else { - fs_types = fs_types->next; - } + else + fs_types = fs_type->next; } /** -- cgit v1.2.1