aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2011-01-22 16:40:49 -0500
committerPeter Hutterer <peter.hutterer@who-t.net>2011-01-24 14:12:46 +1000
commitb5c9f41b2b6c680b7c44eadef8da855b1d9adcb7 (patch)
treeb8ec11855f9bef9f578455772c7bf468290d2fa3
parentRemove support for X input ABI < 12.2 (diff)
downloadxf86-input-evdev-b5c9f41b2b6c680b7c44eadef8da855b1d9adcb7.tar.gz
xf86-input-evdev-b5c9f41b2b6c680b7c44eadef8da855b1d9adcb7.tar.bz2
xf86-input-evdev-b5c9f41b2b6c680b7c44eadef8da855b1d9adcb7.zip
Switch to "goto" logic for error handling when adding classes
This will be necessary for the addition of multitouch functionality. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 2bab6fe..2596f87 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -946,11 +946,11 @@ EvdevAddAbsClass(DeviceIntPtr device)
pEvdev = pInfo->private;
if (!TestBit(EV_ABS, pEvdev->bitmask))
- return !Success;
+ goto out;
num_axes = EvdevCountBits(pEvdev->abs_bitmask, NLONGS(ABS_MAX));
if (num_axes < 1)
- return !Success;
+ goto out;
if (num_axes > MAX_VALUATORS) {
xf86Msg(X_WARNING, "%s: found %d axes, limiting to %d.\n", device->name, num_axes, MAX_VALUATORS);
@@ -976,7 +976,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
GetMotionHistorySize(), Absolute)) {
xf86Msg(X_ERROR, "%s: failed to initialize valuator class device.\n",
device->name);
- return !Success;
+ goto out;
}
for (axis = ABS_X; axis <= ABS_MAX; axis++) {
@@ -1018,7 +1018,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc)) {
xf86Msg(X_ERROR, "%s: failed to initialize pointer feedback class "
"device.\n", device->name);
- return !Success;
+ goto out;
}
if (pEvdev->flags & EVDEV_TOUCHPAD)
@@ -1040,6 +1040,9 @@ EvdevAddAbsClass(DeviceIntPtr device)
}
return Success;
+
+out:
+ return !Success;
}
static int
@@ -1054,11 +1057,11 @@ EvdevAddRelClass(DeviceIntPtr device)
pEvdev = pInfo->private;
if (!TestBit(EV_REL, pEvdev->bitmask))
- return !Success;
+ goto out;
num_axes = EvdevCountBits(pEvdev->rel_bitmask, NLONGS(REL_MAX));
if (num_axes < 1)
- return !Success;
+ goto out;
/* Wheels are special, we post them as button events. So let's ignore them
* in the axes list too */
@@ -1070,7 +1073,7 @@ EvdevAddRelClass(DeviceIntPtr device)
num_axes--;
if (num_axes <= 0)
- return !Success;
+ goto out;
if (num_axes > MAX_VALUATORS) {
xf86Msg(X_WARNING, "%s: found %d axes, limiting to %d.\n", device->name, num_axes, MAX_VALUATORS);
@@ -1099,13 +1102,13 @@ EvdevAddRelClass(DeviceIntPtr device)
GetMotionHistorySize(), Relative)) {
xf86Msg(X_ERROR, "%s: failed to initialize valuator class device.\n",
device->name);
- return !Success;
+ goto out;
}
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc)) {
xf86Msg(X_ERROR, "%s: failed to initialize pointer feedback class "
"device.\n", device->name);
- return !Success;
+ goto out;
}
for (axis = REL_X; axis <= REL_MAX; axis++)
@@ -1122,6 +1125,9 @@ EvdevAddRelClass(DeviceIntPtr device)
free(atoms);
return Success;
+
+out:
+ return !Success;
}
static int