This information is retrieved multiple time. Avoid to use just g_object_get which is dynamic so potentially unsafe and slow. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/char-device.c | 5 +++++ server/char-device.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/server/char-device.c b/server/char-device.c index 03ac9907c..36e22dee3 100644 --- a/server/char-device.c +++ b/server/char-device.c @@ -1166,6 +1166,11 @@ SPICE_GNUC_VISIBLE void spice_server_port_event(SpiceCharDeviceInstance *sin, ui return klass->port_event(sin->st, event); } +SpiceCharDeviceInstance *red_char_device_get_device_instance(RedCharDevice *dev) +{ + return dev->priv->sin; +} + static void red_char_device_init(RedCharDevice *self) { diff --git a/server/char-device.h b/server/char-device.h index 0a87045b7..830ca456d 100644 --- a/server/char-device.h +++ b/server/char-device.h @@ -243,6 +243,8 @@ RedCharDevice *spicevmc_device_connect(RedsState *reds, uint8_t channel_type); void spicevmc_device_disconnect(SpiceCharDeviceInstance *char_device); +SpiceCharDeviceInstance *red_char_device_get_device_instance(RedCharDevice *dev); + SpiceCharDeviceInterface *spice_char_device_get_interface(SpiceCharDeviceInstance *instance); #endif /* CHAR_DEVICE_H_ */ -- 2.21.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel