comapt: Add FpDeviceClass compatibility autoptr and use it
This commit is contained in:
parent
169ca1ba77
commit
cfbd5d27b7
5 changed files with 12 additions and 12 deletions
|
@ -131,8 +131,7 @@ usb_device_added_cb (FpContext *self, GUsbDevice *device, GUsbContext *usb_ctx)
|
|||
for (i = 0; i < priv->drivers->len; i++)
|
||||
{
|
||||
GType driver = g_array_index (priv->drivers, GType, i);
|
||||
g_autoptr(GTypeClass) type_class = g_type_class_ref (driver);
|
||||
FpDeviceClass *cls = FP_DEVICE_CLASS (type_class);
|
||||
g_autoptr(FpDeviceClass) cls = g_type_class_ref (driver);
|
||||
const FpIdEntry *entry;
|
||||
|
||||
if (cls->type != FP_DEVICE_TYPE_USB)
|
||||
|
@ -276,8 +275,7 @@ fp_context_init (FpContext *self)
|
|||
for (i = 0; i < priv->drivers->len;)
|
||||
{
|
||||
GType driver = g_array_index (priv->drivers, GType, i);
|
||||
g_autoptr(GTypeClass) type_class = g_type_class_ref (driver);
|
||||
FpDeviceClass *cls = FP_DEVICE_CLASS (type_class);
|
||||
g_autoptr(FpDeviceClass) cls = g_type_class_ref (driver);
|
||||
|
||||
if (!is_driver_allowed (cls->id))
|
||||
g_array_remove_index (priv->drivers, i);
|
||||
|
@ -351,8 +349,7 @@ fp_context_enumerate (FpContext *context)
|
|||
for (i = 0; i < priv->drivers->len; i++)
|
||||
{
|
||||
GType driver = g_array_index (priv->drivers, GType, i);
|
||||
g_autoptr(GTypeClass) type_class = g_type_class_ref (driver);
|
||||
FpDeviceClass *cls = FP_DEVICE_CLASS (type_class);
|
||||
g_autoptr(FpDeviceClass) cls = g_type_class_ref (driver);
|
||||
const FpIdEntry *entry;
|
||||
|
||||
if (cls->type != FP_DEVICE_TYPE_VIRTUAL)
|
||||
|
|
|
@ -31,3 +31,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (GParamSpec, g_param_spec_unref);
|
|||
#endif
|
||||
|
||||
#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void))(f))
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 63, 3)
|
||||
typedef struct _FpDeviceClass FpDeviceClass;
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpDeviceClass, g_type_class_unref);
|
||||
#endif
|
||||
|
|
|
@ -38,8 +38,7 @@ insert_drivers (GList *list)
|
|||
for (i = 0; i < drivers->len; i++)
|
||||
{
|
||||
GType driver = g_array_index (drivers, GType, i);
|
||||
g_autoptr(GTypeClass) type_class = g_type_class_ref (driver);
|
||||
FpDeviceClass *cls = FP_DEVICE_CLASS (type_class);
|
||||
g_autoptr(FpDeviceClass) cls = g_type_class_ref (driver);
|
||||
const FpIdEntry *entry;
|
||||
|
||||
if (cls->type != FP_DEVICE_TYPE_USB)
|
||||
|
|
|
@ -104,8 +104,7 @@ main (int argc, char **argv)
|
|||
for (i = 0; i < drivers->len; i++)
|
||||
{
|
||||
GType driver = g_array_index (drivers, GType, i);
|
||||
g_autoptr(GTypeClass) type_class = g_type_class_ref (driver);
|
||||
FpDeviceClass *cls = FP_DEVICE_CLASS (type_class);
|
||||
g_autoptr(FpDeviceClass) cls = g_type_class_ref (driver);
|
||||
|
||||
if (cls->type != FP_DEVICE_TYPE_USB)
|
||||
continue;
|
||||
|
|
|
@ -64,13 +64,13 @@ static FpAutoResetClass default_fake_dev_class = {0};
|
|||
static FpAutoResetClass *
|
||||
auto_reset_device_class (void)
|
||||
{
|
||||
g_autoptr(GTypeClass) type_class = NULL;
|
||||
g_autoptr(FpDeviceClass) type_class = NULL;
|
||||
FpDeviceClass *dev_class = g_type_class_peek_static (FPI_TYPE_DEVICE_FAKE);
|
||||
|
||||
if (!dev_class)
|
||||
{
|
||||
type_class = g_type_class_ref (FPI_TYPE_DEVICE_FAKE);
|
||||
dev_class = (FpDeviceClass *) type_class;
|
||||
dev_class = type_class;
|
||||
g_assert_nonnull (dev_class);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue