Re: One to many (Dirves to Volumes) patch take 2



On Tue, 2004-07-13 at 21:13, John (J5) Palmieri wrote:
> Here is take 2 with all the suggestions implemented.

drive_finalize:

+	if (priv->volumes) {

skip the if, just use for loop over the list. It'll never run if the
list is NULL.

Also, the priv->volumes list is leaked


+	for (vol_list = drive->priv->volumes; vol_list != NULL; vol_list =
g_list_next (vol_list)) {  
+		GnomeVFSVolume *volume = GNOME_VFS_VOLUME (vol_list->data);
 		_gnome_vfs_volume_unset_drive (volume, drive);
-		_gnome_vfs_drive_unset_volume (drive, volume);
+		_gnome_vfs_drive_remove_volume (drive, volume);

This modifies the list (in remove_volume) while reading it. It needs to
make a copy of the list before starting to iterate.

Also, there is really no need to use g_list_next. It just makes things
more verbose.

@@ -566,28 +566,26 @@ gnome_vfs_drive_unmount (GnomeVFSDrive  

Use a for to loop the list, skip the if.





=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a war-weary Republican assassin in drag. She's a sharp-shooting 
extravagent magician's assistant with a knack for trouble. They fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]