mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-06 07:06:10 +00:00
u/system_helpers: Tidy functions [NFC]
This commit is contained in:
parent
a9933c4314
commit
464a95abed
|
@ -58,6 +58,13 @@ u_system_devices_close(struct xrt_system_devices *xsysd)
|
||||||
xrt_frame_context_destroy_nodes(&usysd->xfctx);
|
xrt_frame_context_destroy_nodes(&usysd->xfctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Generic system devices helper.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
xrt_result_t
|
xrt_result_t
|
||||||
u_system_devices_create_from_prober(struct xrt_instance *xinst,
|
u_system_devices_create_from_prober(struct xrt_instance *xinst,
|
||||||
struct xrt_system_devices **out_xsysd,
|
struct xrt_system_devices **out_xsysd,
|
||||||
|
|
|
@ -71,6 +71,34 @@ u_system_devices_allocate(void);
|
||||||
void
|
void
|
||||||
u_system_devices_close(struct xrt_system_devices *xsysd);
|
u_system_devices_close(struct xrt_system_devices *xsysd);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Destroy an u_system_devices_allocate and owned devices - helper function.
|
||||||
|
*
|
||||||
|
* @param[in,out] usysd_ptr A pointer to the u_system_devices_allocate struct pointer.
|
||||||
|
*
|
||||||
|
* Will destroy the system devices if *usysd_ptr is not NULL. Will then set *usysd_ptr to NULL.
|
||||||
|
*
|
||||||
|
* @public @memberof u_system_devices_allocate
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
u_system_devices_destroy(struct u_system_devices **usysd_ptr)
|
||||||
|
{
|
||||||
|
struct u_system_devices *usysd = *usysd_ptr;
|
||||||
|
if (usysd == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*usysd_ptr = NULL;
|
||||||
|
usysd->base.destroy(&usysd->base);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Generic system devices helper.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Takes a @ref xrt_instance, gets the prober from it and then uses the prober
|
* Takes a @ref xrt_instance, gets the prober from it and then uses the prober
|
||||||
* to allocate a filled in @ref u_system_devices.
|
* to allocate a filled in @ref u_system_devices.
|
||||||
|
@ -95,27 +123,6 @@ u_system_devices_create_from_prober(struct xrt_instance *xinst,
|
||||||
struct xrt_device *
|
struct xrt_device *
|
||||||
u_system_devices_get_ht_device(struct u_system_devices *usysd, enum xrt_input_name name);
|
u_system_devices_get_ht_device(struct u_system_devices *usysd, enum xrt_input_name name);
|
||||||
|
|
||||||
/*!
|
|
||||||
* Destroy an u_system_devices_allocate and owned devices - helper function.
|
|
||||||
*
|
|
||||||
* @param[in,out] usysd_ptr A pointer to the u_system_devices_allocate struct pointer.
|
|
||||||
*
|
|
||||||
* Will destroy the system devices if *usysd_ptr is not NULL. Will then set *usysd_ptr to NULL.
|
|
||||||
*
|
|
||||||
* @public @memberof u_system_devices_allocate
|
|
||||||
*/
|
|
||||||
static inline void
|
|
||||||
u_system_devices_destroy(struct u_system_devices **usysd_ptr)
|
|
||||||
{
|
|
||||||
struct u_system_devices *usysd = *usysd_ptr;
|
|
||||||
if (usysd == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*usysd_ptr = NULL;
|
|
||||||
usysd->base.destroy(&usysd->base);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue