Fix all warnings caused by -Wunused-but-set-variable
authorDavid Zeuthen <davidz@redhat.com>
Tue, 15 Mar 2011 13:32:47 +0000 (09:32 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Tue, 15 Mar 2011 13:32:47 +0000 (09:32 -0400)
This is new with gcc 4.6.

Signed-off-by: David Zeuthen <davidz@redhat.com>
src/adapter.c
src/daemon.c
src/device.c
src/expander.c
src/helpers/job-create-partition.c
src/helpers/job-delete-partition.c
src/helpers/partutil.c
src/port.c
tools/udisks.c

index a197c2e..b85a0ef 100644 (file)
@@ -258,7 +258,6 @@ compute_object_path (const char *native_path)
 static gboolean
 register_disks_adapter (Adapter *adapter)
 {
-  DBusConnection *connection;
   GError *error = NULL;
 
   adapter->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -271,7 +270,6 @@ register_disks_adapter (Adapter *adapter)
         }
       goto error;
     }
-  connection = dbus_g_connection_get_connection (adapter->priv->system_bus_connection);
 
   adapter->priv->object_path = compute_object_path (adapter->priv->native_path);
 
@@ -430,9 +428,7 @@ update_info_fabric_and_num_ports (Adapter *adapter)
   guint num_ports;
   guint64 device_class;
   const gchar *driver;
-  guint class;
   guint subclass;
-  guint interface;
   gchar *scsi_host_name;
   gchar *s;
   gchar *s2;
@@ -445,9 +441,7 @@ update_info_fabric_and_num_ports (Adapter *adapter)
   device_class = g_udev_device_get_sysfs_attr_as_uint64 (adapter->priv->d, "class");
   driver = g_udev_device_get_driver (adapter->priv->d);
 
-  class = (device_class & 0xff0000) >> 16;
   subclass = (device_class & 0x00ff00) >> 8;
-  interface = (device_class & 0x0000ff);
 
   /* count number of scsi_host objects - this is to detect whether we are dealing with
    * ATA - see comment in port.c:update_info_ata() for details about
index afcd8fb..075db22 100644 (file)
@@ -213,9 +213,6 @@ daemon_constructor (GType type,
                     GObjectConstructParam *construct_properties)
 {
   Daemon *daemon;
-  DaemonClass *klass;
-
-  klass = DAEMON_CLASS (g_type_class_peek (TYPE_DAEMON));
 
   daemon = DAEMON (G_OBJECT_CLASS (daemon_parent_class)->constructor (type,
                                                                       n_construct_properties,
@@ -769,9 +766,6 @@ _filter (DBusConnection *connection,
          void *user_data)
 {
   //Daemon *daemon = DAEMON (user_data);
-  const char *interface;
-
-  interface = dbus_message_get_interface (message);
 
   if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
     {
index 6f244cb..bee68e0 100644 (file)
@@ -344,9 +344,6 @@ device_constructor (GType type,
                     GObjectConstructParam *construct_properties)
 {
   Device *device;
-  DeviceClass *klass;
-
-  klass = DEVICE_CLASS (g_type_class_peek (TYPE_DEVICE));
 
   device = DEVICE (G_OBJECT_CLASS (device_parent_class)->constructor (type,
                                                                       n_construct_properties,
@@ -1937,7 +1934,6 @@ compute_object_path (const char *native_path)
 static gboolean
 register_disks_device (Device *device)
 {
-  DBusConnection *connection;
   GError *error = NULL;
 
   device->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -1950,8 +1946,6 @@ register_disks_device (Device *device)
         }
       goto error;
     }
-  connection = dbus_g_connection_get_connection (device->priv->system_bus_connection);
-
   device->priv->object_path = compute_object_path (device->priv->native_path);
 
   /* safety first */
@@ -2490,7 +2484,6 @@ update_info_partition (Device *device)
    */
   if (!is_partition && sysfs_file_exists (device->priv->native_path, "start"))
     {
-      guint64 start;
       guint64 size;
       guint64 offset;
       guint64 alignment_offset;
@@ -2498,7 +2491,6 @@ update_info_partition (Device *device)
       guint n;
 
       device_set_device_is_partition (device, TRUE);
-      start = sysfs_get_uint64 (device->priv->native_path, "start");
       size = sysfs_get_uint64 (device->priv->native_path, "size");
       alignment_offset = sysfs_get_uint64 (device->priv->native_path, "alignment_offset");
 
@@ -6707,7 +6699,6 @@ device_filesystem_unmount_authorized_cb (Daemon *daemon,
   gchar **options = user_data_elements[0];
   int n;
   char *argv[16];
-  GError *error;
   gboolean force_unmount;
   char *mount_path;
   uid_t uid;
@@ -6774,7 +6765,6 @@ device_filesystem_unmount_authorized_cb (Daemon *daemon,
   argv[n++] = NULL;
 
  run_job:
-  error = NULL;
   if (!job_new (context,
                 "FilesystemUnmount",
                 FALSE,
@@ -6959,7 +6949,6 @@ device_filesystem_list_open_files_authorized_cb (Daemon *daemon,
 {
   int n;
   char *argv[16];
-  GError *error;
 
   if (!device->priv->device_is_mounted || device->priv->device_mount_paths->len == 0)
     {
@@ -6973,7 +6962,6 @@ device_filesystem_list_open_files_authorized_cb (Daemon *daemon,
   argv[n++] = ((gchar **) device->priv->device_mount_paths->pdata)[0];
   argv[n++] = NULL;
 
-  error = NULL;
   if (!job_new (context, NULL, /* don't run this as a job */
                 FALSE, device, argv, NULL, filesystem_list_open_files_completed_cb, FALSE, NULL, NULL))
     {
@@ -7053,10 +7041,8 @@ device_drive_eject_authorized_cb (Daemon *daemon,
   int n;
   char *argv[16];
   GError *error;
-  char *mount_path;
 
   error = NULL;
-  mount_path = NULL;
 
   if (!device->priv->device_is_drive)
     {
@@ -7175,10 +7161,8 @@ device_drive_detach_authorized_cb (Daemon *daemon,
   int n;
   char *argv[16];
   GError *error;
-  char *mount_path;
 
   error = NULL;
-  mount_path = NULL;
 
   if (!device->priv->device_is_drive)
     {
@@ -7307,7 +7291,6 @@ device_filesystem_check_authorized_cb (Daemon *daemon,
   //gchar **options = user_data_elements[0];
   int n;
   char *argv[16];
-  GError *error;
 
   /* TODO: change when we have a file system that supports online fsck */
   if (device->priv->device_is_mounted)
@@ -7322,7 +7305,6 @@ device_filesystem_check_authorized_cb (Daemon *daemon,
   argv[n++] = device->priv->device_file;
   argv[n++] = NULL;
 
-  error = NULL;
   if (!job_new (context, "FilesystemCheck", FALSE, device, argv, NULL, filesystem_check_completed_cb, FALSE, NULL, NULL))
     {
       goto out;
@@ -9403,7 +9385,6 @@ device_luks_lock_authorized_cb (Daemon *daemon,
   Device *cleartext_device;
   int n;
   char *argv[10];
-  GError *error;
 
   if (device->priv->id_usage == NULL || strcmp (device->priv->id_usage, "crypto") != 0)
     {
@@ -9430,7 +9411,6 @@ device_luks_lock_authorized_cb (Daemon *daemon,
   argv[n++] = cleartext_device->priv->dm_name;
   argv[n++] = NULL;
 
-  error = NULL;
   if (!job_new (context,
                 "LuksLock",
                 FALSE,
@@ -9562,7 +9542,6 @@ device_luks_change_passphrase_authorized_cb (Daemon *daemon,
   const char *new_secret = user_data_elements[1];
   int n;
   char *argv[10];
-  GError *error;
   char *secrets_as_stdin;
 
   secrets_as_stdin = NULL;
@@ -9580,7 +9559,6 @@ device_luks_change_passphrase_authorized_cb (Daemon *daemon,
   argv[n++] = device->priv->device_file;
   argv[n++] = NULL;
 
-  error = NULL;
   if (!job_new (context,
                 "LuksChangePassphrase",
                 FALSE,
@@ -9934,7 +9912,6 @@ device_drive_ata_smart_refresh_data_authorized_cb (Daemon *daemon,
   char **options = user_data_elements[0];
   int n;
   char *argv[10];
-  GError *error;
   const char *simuldata;
   gboolean nowakeup;
   uid_t caller_uid;
@@ -9987,8 +9964,6 @@ device_drive_ata_smart_refresh_data_authorized_cb (Daemon *daemon,
       argv[n++] = NULL;
     }
 
-  error = NULL;
-
   if (!job_new (context, NULL, /* don't run this as a job */
                 FALSE, device, argv, NULL, drive_ata_smart_refresh_data_completed_cb, FALSE, NULL, NULL))
     {
@@ -10081,7 +10056,6 @@ device_drive_ata_smart_initiate_selftest_authorized_cb (Daemon *daemon,
   //gchar       **options = user_data_elements[1];
   int n;
   char *argv[10];
-  GError *error;
   const gchar *job_name;
 
   if (g_strcmp0 (test, "short") == 0)
@@ -10108,7 +10082,6 @@ device_drive_ata_smart_initiate_selftest_authorized_cb (Daemon *daemon,
   argv[n++] = (char *) test;
   argv[n++] = NULL;
 
-  error = NULL;
   if (!job_new (context,
                 job_name,
                 TRUE,
@@ -10208,7 +10181,6 @@ device_linux_md_stop_authorized_cb (Daemon *daemon,
   //gchar       **options = user_data_elements[0];
   int n;
   char *argv[10];
-  GError *error;
 
   n = 0;
   argv[n++] = "mdadm";
@@ -10216,7 +10188,6 @@ device_linux_md_stop_authorized_cb (Daemon *daemon,
   argv[n++] = device->priv->device_file;
   argv[n++] = NULL;
 
-  error = NULL;
   if (!job_new (context, "LinuxMdStop", TRUE, device, argv, NULL, linux_md_stop_completed_cb, FALSE, NULL, NULL))
     {
       goto out;
@@ -10297,13 +10268,10 @@ device_linux_md_check_authorized_cb (Daemon *daemon,
                                      gpointer *user_data_elements)
 {
   gchar **options = user_data_elements[0];
-  gchar *filename;
   int n, m;
   char *argv[128];
   const gchar *job_name;
 
-  filename = NULL;
-
   if (!device->priv->device_is_linux_md)
     {
       throw_error (context, ERROR_FAILED, "Device is not a Linux md drive");
@@ -10843,7 +10811,6 @@ device_linux_md_remove_component_authorized_cb (Daemon *daemon,
   char **options = user_data_elements[1];
   int n, m;
   char *argv[128];
-  GError *error;
   Device *slave;
 
   slave = daemon_local_find_by_object_path (device->priv->daemon, component);
@@ -10881,7 +10848,6 @@ device_linux_md_remove_component_authorized_cb (Daemon *daemon,
     }
   argv[n++] = NULL;
 
-  error = NULL;
   if (!job_new (context,
                 "LinuxMdRemoveComponent",
                 TRUE,
index 80e75b7..734ec0a 100644 (file)
@@ -290,7 +290,6 @@ compute_object_path (const char *native_path)
 static gboolean
 register_disks_expander (Expander *expander)
 {
-  DBusConnection *connection;
   GError *error = NULL;
 
   expander->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -303,7 +302,6 @@ register_disks_expander (Expander *expander)
         }
       goto error;
     }
-  connection = dbus_g_connection_get_connection (expander->priv->system_bus_connection);
 
   expander->priv->object_path = compute_object_path (expander->priv->native_path);
 
index 9f8b202..80277b8 100644 (file)
@@ -49,7 +49,6 @@ main (int argc,
   int n;
   int ret;
   const char *device;
-  char **options;
   char *label;
   char *type;
   char *flags_as_string;
@@ -85,7 +84,6 @@ main (int argc,
   type = argv[4];
   label = argv[5];
   flags_as_string = argv[6];
-  options = argv + 7;
 
   flags = g_strsplit (flags_as_string, ",", 0);
 
index 44945d2..2f2775a 100644 (file)
@@ -47,7 +47,6 @@ main (int argc,
 {
   int ret;
   const char *device;
-  const char *partition_device;
   char **options;
   int n;
   guint64 offset;
@@ -63,7 +62,6 @@ main (int argc,
       goto out;
     }
   device = argv[1];
-  partition_device = argv[2];
   offset = strtoll (argv[3], &endp, 10);
   if (*endp != '\0')
     {
index 3bd64b8..72a8fe3 100644 (file)
@@ -851,7 +851,6 @@ part_table_parse_apple (int fd,
     /* more stuff */
   }__attribute__ ((packed)) mac_part;
   int block_size;
-  int block_count;
   int map_count;
 
   DEBUG ("Entering Apple parser");
@@ -876,7 +875,6 @@ part_table_parse_apple (int fd,
     }
 
   block_size = GUINT16_FROM_BE (mac_header.block_size);
-  block_count = GUINT32_FROM_BE (mac_header.block_count); /* num blocks on whole disk */
 
   DEBUG ("Mac MAGIC found, block_size=%d", block_size);
 
index f52ae51..a43f019 100644 (file)
@@ -262,7 +262,6 @@ compute_object_path (Port *port)
 static gboolean
 register_disks_port (Port *port)
 {
-  DBusConnection *connection;
   GError *error = NULL;
 
   port->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -275,7 +274,6 @@ register_disks_port (Port *port)
         }
       goto error;
     }
-  connection = dbus_g_connection_get_connection (port->priv->system_bus_connection);
 
   port->priv->object_path = compute_object_path (port);
 
index 6481efb..ea6d2fc 100644 (file)
@@ -931,12 +931,8 @@ device_properties_get (DBusGConnection *bus,
 static gboolean
 do_monitor (void)
 {
-  GError *error;
-
   g_print ("Monitoring activity from the disks daemon. Press Ctrl+C to cancel.\n");
 
-  error = NULL;
-
   dbus_g_proxy_connect_signal (disks_proxy, "DeviceAdded", G_CALLBACK (device_added_signal_handler), NULL, NULL);
   dbus_g_proxy_connect_signal (disks_proxy, "DeviceRemoved", G_CALLBACK (device_removed_signal_handler), NULL, NULL);
   dbus_g_proxy_connect_signal (disks_proxy, "DeviceChanged", G_CALLBACK (device_changed_signal_handler), NULL, NULL);