summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-11-03 14:25:51 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-11-29 15:12:32 +1000
commitbedb8fd90de8e2db33d5e3b1d859f24bf34efc9a (patch)
tree5f662c7f0d4428010ae7406375ab62b9dcdd778f /Xi
parent2aad1a2b42b7def7812abfa2462b6bcc6382e03a (diff)
Xi: use single return code from XIPassiveGrabDevice
Some failures returned status but the actual return code was "ret". Use "ret" consistently and move status to the local block is used in. [the goto isn't necessary yet, but for a future patch] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/xipassivegrab.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 6be27f3d1..2f13a95e8 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -80,7 +80,6 @@ ProcXIPassiveGrabDevice(ClientPtr client)
DeviceIntPtr dev, mod_dev;
xXIPassiveGrabDeviceReply rep;
int i, ret = Success;
- uint8_t status;
uint32_t *modifiers;
xXIGrabModifierInfo *modifiers_failed;
GrabMask mask;
@@ -145,32 +144,36 @@ ProcXIPassiveGrabDevice(ClientPtr client)
if (stuff->cursor != None)
{
- status = dixLookupResourceByType(&tmp, stuff->cursor,
- RT_CURSOR, client, DixUseAccess);
- if (status != Success)
- {
- client->errorValue = stuff->cursor;
- return status;
- }
+ ret = dixLookupResourceByType(&tmp, stuff->cursor,
+ RT_CURSOR, client, DixUseAccess);
+ if (ret != Success)
+ {
+ client->errorValue = stuff->cursor;
+ goto out;
+ }
}
- status = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
- if (status != Success)
- return status;
+ ret = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
+ if (ret != Success)
+ goto out;
- status = CheckGrabValues(client, &param);
- if (status != Success)
- return status;
+ ret = CheckGrabValues(client, &param);
+ if (ret != Success)
+ goto out;
modifiers = (uint32_t*)&stuff[1] + stuff->mask_len;
modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
- if (!modifiers_failed)
- return BadAlloc;
+ if (!modifiers_failed) {
+ ret = BadAlloc;
+ goto out;
+ }
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
{
+ uint8_t status = Success;
+
param.modifiers = *modifiers;
switch(stuff->grab_type)
{
@@ -208,6 +211,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
WriteToClient(client, rep.length * 4, (char*)modifiers_failed);
free(modifiers_failed);
+out:
return ret;
}