From 669fbb098516e0bdf6c62c52c1bcb12580de069b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 1 Nov 2016 10:42:19 +1000 Subject: Drop indentation for matrix handling Exit early if the string is NULL to reduce indentation. No functional changes. Signed-off-by: Peter Hutterer --- src/xf86libinput.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/xf86libinput.c b/src/xf86libinput.c index 07b4d4e..a6481bc 100644 --- a/src/xf86libinput.c +++ b/src/xf86libinput.c @@ -2331,6 +2331,7 @@ xf86libinput_parse_calibration_option(InputInfoPtr pInfo, { char *str; float matrix[9] = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}; + int num_calibration; memcpy(matrix_out, matrix, sizeof(matrix)); @@ -2340,27 +2341,29 @@ xf86libinput_parse_calibration_option(InputInfoPtr pInfo, libinput_device_config_calibration_get_matrix(device, matrix); memcpy(matrix_out, matrix, sizeof(matrix)); - if ((str = xf86CheckStrOption(pInfo->options, - "CalibrationMatrix", - NULL))) { - int num_calibration = sscanf(str, "%f %f %f %f %f %f %f %f %f ", - &matrix[0], &matrix[1], - &matrix[2], &matrix[3], - &matrix[4], &matrix[5], - &matrix[6], &matrix[7], - &matrix[8]); - if (num_calibration != 9) { - xf86IDrvMsg(pInfo, X_ERROR, - "Invalid matrix: %s, using default\n", str); - } else if (libinput_device_config_calibration_set_matrix(device, - matrix) == - LIBINPUT_CONFIG_STATUS_SUCCESS) { - memcpy(matrix_out, matrix, sizeof(matrix)); - } else - xf86IDrvMsg(pInfo, X_ERROR, - "Failed to apply matrix: %s, using default\n", str); - free(str); - } + str = xf86CheckStrOption(pInfo->options, + "CalibrationMatrix", + NULL); + if (!str) + return; + + num_calibration = sscanf(str, "%f %f %f %f %f %f %f %f %f ", + &matrix[0], &matrix[1], + &matrix[2], &matrix[3], + &matrix[4], &matrix[5], + &matrix[6], &matrix[7], + &matrix[8]); + if (num_calibration != 9) { + xf86IDrvMsg(pInfo, X_ERROR, + "Invalid matrix: %s, using default\n", str); + } else if (libinput_device_config_calibration_set_matrix(device, + matrix) == + LIBINPUT_CONFIG_STATUS_SUCCESS) { + memcpy(matrix_out, matrix, sizeof(matrix)); + } else + xf86IDrvMsg(pInfo, X_ERROR, + "Failed to apply matrix: %s, using default\n", str); + free(str); } static inline BOOL -- cgit v1.2.3