On Sat, Dec 7, 2019 at 12:20 PM Alexander Nezhinsky <anezhins@xxxxxxxxxx> wrote:
On Fri, Dec 6, 2019 at 12:04 PM Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:> + bdev = spice_usb_device_manager_device_to_bdev(self, device);
see below
> +#ifdef USE_USBREDIR
> + SpiceUsbBackendDevice *bdev;
> + gboolean is_cd;
> +
> + bdev = spice_usb_device_manager_device_to_bdev(self, device);
Note that SpiceUsbBackendDevice is defined as
typedef struct _SpiceUsbDevice SpiceUsbBackendDevice;
no need to call this function.
I agree with Yuri. This is the current practice in all API functions.We can rework it everywhere, or leave it as is.
I looked at it just an inch deeper and saw that the function spice_usb_device_manager_device_to_bdev actually increments the reference of the device object.
So it seems to be necessary and the change would require rework of some further logic, i guess.
In view of the fact that the struct is the same, we could change the name of the functions to reflect the refcounting, like:
spice_usb_device_manager_get_bdev_device() or just spice_usb_device_manager_get_device()
What do you think?
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel