mount-matrix: Split off getting the identity mount matrix
This commit is contained in:
@@ -24,6 +24,16 @@ static AccelVec3 id_matrix[3] = {
|
|||||||
|
|
||||||
static char axis_names[] = "xyz";
|
static char axis_names[] = "xyz";
|
||||||
|
|
||||||
|
AccelVec3 *
|
||||||
|
get_id_matrix (void)
|
||||||
|
{
|
||||||
|
#if GLIB_CHECK_VERSION(2, 68, 0)
|
||||||
|
return g_memdup2 (id_matrix, sizeof(id_matrix));
|
||||||
|
#else
|
||||||
|
return g_memdup (id_matrix, sizeof(id_matrix));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
AccelVec3 *
|
AccelVec3 *
|
||||||
setup_mount_matrix (GUdevDevice *device)
|
setup_mount_matrix (GUdevDevice *device)
|
||||||
{
|
{
|
||||||
@@ -115,14 +125,9 @@ parse_mount_matrix (const char *mtx,
|
|||||||
|
|
||||||
g_return_val_if_fail (vecs != NULL, FALSE);
|
g_return_val_if_fail (vecs != NULL, FALSE);
|
||||||
|
|
||||||
|
|
||||||
/* Empty string means we use the identity matrix */
|
/* Empty string means we use the identity matrix */
|
||||||
if (mtx == NULL || *mtx == '\0') {
|
if (mtx == NULL || *mtx == '\0') {
|
||||||
#if GLIB_CHECK_VERSION(2, 68, 0)
|
*vecs = get_id_matrix ();
|
||||||
*vecs = g_memdup2 (id_matrix, sizeof(id_matrix));
|
|
||||||
#else
|
|
||||||
*vecs = g_memdup (id_matrix, sizeof(id_matrix));
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user