diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2016-11-01 10:42:19 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2016-11-01 10:42:19 +1000 |
commit | 669fbb098516e0bdf6c62c52c1bcb12580de069b (patch) | |
tree | 7c5b7b3be890235e248310487d3c54d8d30d952a | |
parent | c4f0a9bcb846f70b85a285e8acea8fe086abdccb (diff) |
Drop indentation for matrix handling
Exit early if the string is NULL to reduce indentation. No functional changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/xf86libinput.c | 45 |
1 files 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 |