mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 17:56:17 +01:00
Initialize variable
The `mount_monitor` variable is only set if the boolean `with_mount_monitor` variable is set to TRUE, but the compiler does not know that, so it'll warn when calling `g_clear_object()` even if the clearing operation is gated with the same boolean. Initializing with NULL does not cost us anything, and eliminates a conditional branch. https://bugzilla.gnome.org/show_bug.cgi?id=794732
This commit is contained in:
parent
dd8d33d968
commit
ac42183c33
@ -29,7 +29,7 @@ test_filesystem_readonly (gconstpointer with_mount_monitor)
|
||||
{
|
||||
GFileInfo *file_info;
|
||||
GFile *mounted_file;
|
||||
GUnixMountMonitor *mount_monitor;
|
||||
GUnixMountMonitor *mount_monitor = NULL;
|
||||
gchar *bindfs, *fusermount;
|
||||
gchar *command_mount, *command_mount_ro, *command_umount;
|
||||
gchar *curdir, *dir_to_mount, *dir_mountpoint;
|
||||
@ -62,9 +62,7 @@ test_filesystem_readonly (gconstpointer with_mount_monitor)
|
||||
}
|
||||
|
||||
if (with_mount_monitor)
|
||||
{
|
||||
mount_monitor = g_unix_mount_monitor_get ();
|
||||
}
|
||||
mount_monitor = g_unix_mount_monitor_get ();
|
||||
|
||||
/* Use bindfs, which does not need root privileges, to mount the contents of one dir
|
||||
* into another dir (and do the mount as readonly as per passed '-o ro' option) */
|
||||
@ -125,9 +123,7 @@ test_filesystem_readonly (gconstpointer with_mount_monitor)
|
||||
}
|
||||
|
||||
/* Clean up */
|
||||
if (with_mount_monitor)
|
||||
g_clear_object (&mount_monitor);
|
||||
|
||||
g_clear_object (&mount_monitor);
|
||||
g_clear_object (&file_info);
|
||||
g_clear_object (&mounted_file);
|
||||
g_spawn_command_line_sync (command_umount, NULL, NULL, NULL, NULL); /* unmount */
|
||||
|
Loading…
Reference in New Issue
Block a user