common: Use g_auto for variables
This commit is contained in:
parent
eff88ab2f1
commit
86d1d30c63
11 changed files with 134 additions and 244 deletions
|
@ -78,8 +78,7 @@ create_device (GUdevDevice *udev_device)
|
|||
{
|
||||
const gchar *vendor, *product, *name;
|
||||
guint width, height;
|
||||
GUdevDevice *parent;
|
||||
GsdDevice *device;
|
||||
g_autoptr(GUdevDevice) parent = NULL;
|
||||
|
||||
parent = g_udev_device_get_parent (udev_device);
|
||||
g_assert (parent != NULL);
|
||||
|
@ -96,19 +95,15 @@ create_device (GUdevDevice *udev_device)
|
|||
width = g_udev_device_get_property_as_int (udev_device, "ID_INPUT_WIDTH_MM");
|
||||
height = g_udev_device_get_property_as_int (udev_device, "ID_INPUT_HEIGHT_MM");
|
||||
|
||||
device = g_object_new (GSD_TYPE_DEVICE,
|
||||
"name", name,
|
||||
"device-file", g_udev_device_get_device_file (udev_device),
|
||||
"type", udev_device_get_device_type (udev_device),
|
||||
"vendor-id", vendor,
|
||||
"product-id", product,
|
||||
"width", width,
|
||||
"height", height,
|
||||
NULL);
|
||||
|
||||
g_object_unref (parent);
|
||||
|
||||
return device;
|
||||
return g_object_new (GSD_TYPE_DEVICE,
|
||||
"name", name,
|
||||
"device-file", g_udev_device_get_device_file (udev_device),
|
||||
"type", udev_device_get_device_type (udev_device),
|
||||
"vendor-id", vendor,
|
||||
"product-id", product,
|
||||
"width", width,
|
||||
"height", height,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -166,7 +161,8 @@ static void
|
|||
gsd_udev_device_manager_init (GsdUdevDeviceManager *manager)
|
||||
{
|
||||
const gchar *subsystems[] = { "input", NULL };
|
||||
GList *devices, *l;
|
||||
g_autoptr(GList) devices = NULL;
|
||||
GList *l;
|
||||
|
||||
manager->devices = g_hash_table_new_full (NULL, NULL,
|
||||
(GDestroyNotify) g_object_unref,
|
||||
|
@ -180,15 +176,11 @@ gsd_udev_device_manager_init (GsdUdevDeviceManager *manager)
|
|||
subsystems[0]);
|
||||
|
||||
for (l = devices; l; l = l->next) {
|
||||
GUdevDevice *device = l->data;
|
||||
g_autoptr(GUdevDevice) device = l->data;
|
||||
|
||||
if (device_is_evdev (device))
|
||||
add_device (manager, device);
|
||||
|
||||
g_object_unref (device);
|
||||
}
|
||||
|
||||
g_list_free (devices);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue