mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
u/time: Send in a pointer to pointer to the timekeeping destroy function
This commit is contained in:
parent
786e67f189
commit
ee3d9d08f6
|
@ -52,7 +52,14 @@ time_state_create()
|
||||||
extern "C" void
|
extern "C" void
|
||||||
time_state_destroy(struct time_state **state_ptr)
|
time_state_destroy(struct time_state **state_ptr)
|
||||||
{
|
{
|
||||||
|
struct time_state *state = *state_ptr;
|
||||||
|
|
||||||
|
if (state == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
delete state;
|
delete state;
|
||||||
|
*state_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" timepoint_ns
|
extern "C" timepoint_ns
|
||||||
|
|
|
@ -93,7 +93,7 @@ time_state_create();
|
||||||
* @ingroup aux_util
|
* @ingroup aux_util
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
time_state_destroy(struct time_state *state);
|
time_state_destroy(struct time_state **state);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get the current time as an integer timestamp.
|
* Get the current time as an integer timestamp.
|
||||||
|
|
|
@ -712,7 +712,8 @@ psmv_run_thread(void *ptr)
|
||||||
|
|
||||||
// Now wait for a package to sync up, it's discarded but that's okay.
|
// Now wait for a package to sync up, it's discarded but that's okay.
|
||||||
if (!psmv_read_one_packet(psmv, data.buffer, sizeof(data))) {
|
if (!psmv_read_one_packet(psmv, data.buffer, sizeof(data))) {
|
||||||
time_state_destroy(time);
|
// Does null checking and sets to null.
|
||||||
|
time_state_destroy(&time);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -752,7 +753,8 @@ psmv_run_thread(void *ptr)
|
||||||
os_mutex_unlock(&psmv->lock);
|
os_mutex_unlock(&psmv->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
time_state_destroy(time);
|
// Does null checking and sets to null.
|
||||||
|
time_state_destroy(&time);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -897,11 +897,10 @@ teardown(struct psvr_device *psvr)
|
||||||
/*
|
/*
|
||||||
* This needs to happen last because when waiting for
|
* This needs to happen last because when waiting for
|
||||||
* device control changes we can get IMU update packets.
|
* device control changes we can get IMU update packets.
|
||||||
|
*
|
||||||
|
* Does null checking and setting of null.
|
||||||
*/
|
*/
|
||||||
if (psvr->timekeeping != NULL) {
|
time_state_destroy(&psvr->timekeeping);
|
||||||
time_state_destroy(psvr->timekeeping);
|
|
||||||
psvr->timekeeping = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,8 @@ oxr_instance_destroy(struct oxr_logger *log, struct oxr_handle_base *hb)
|
||||||
|
|
||||||
xrt_prober_destroy(&inst->prober);
|
xrt_prober_destroy(&inst->prober);
|
||||||
|
|
||||||
if (inst->timekeeping != NULL) {
|
// Does null checking and sets to null.
|
||||||
time_state_destroy(inst->timekeeping);
|
time_state_destroy(&inst->timekeeping);
|
||||||
inst->timekeeping = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(inst);
|
free(inst);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue