On Thu, 14 Jan 2010 17:18:41 +0200, Tiago Vignatti <[email protected]> 
wrote:
> The semantic remains, only code was moved: reuse chunk of code to realize
> cursor on both AllocARGBCursor and AllocGlyphCursor.

Sounds like a sensible idea.

> +    if (rc != Success)
> +        goto error;
> +
> +    if (RealizeCursorAllScreens(pCurs)) {
> +        *ppCurs = pCurs;
> +        return Success;
>      }
> -    *ppCurs = pCurs;
> -    return rc;
> +
> +error:
> +    dixFreePrivates(pCurs->devPrivates);
> +    FreeCursorBits(bits);
> +    xfree(pCurs);
> +
> +    return BadAlloc;

I'd rather see this use a slightly different pattern:

    if (rc != Success)
       goto error;
    rc = RealizeCursorAllScreens(pCurs);
    if (rc != Success)
       goto error;
    *ppCurs = pCurs;
    return Success;
error:
    dixFreePrivates(pCurs->devPrivates);
    FreeCursorBits(bits);
    xfree(pCurs);

    return rc;

This returns the value from XaceHook on failure, and makes all errors go
through an easily identified path (with no-one falling through the
error: label).
    

> +    if (rc != Success)
> +        goto error;
>  
> -                    (*pscr->UnrealizeCursor)(inputInfo.pointer, pscr, pCurs);
> +    if (RealizeCursorAllScreens(pCurs)) {
> +        *ppCurs = pCurs;
> +        return Success;
> +    }

Same thing here;

-- 
[email protected]

Attachment: pgpKwoNouto3h.pgp
Description: PGP signature

_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to