[PATCH libXi] XIChangeHierarchy: Return Success early if no actual changes are requested.

Jeremy Huddleston jeremyhu at apple.com
Mon May 2 22:33:14 PDT 2011


Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On May 2, 2011, at 9:58 PM, Peter Hutterer wrote:

> Do the same for negative num_changes.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> man/XIChangeHierarchy.txt |    3 ++-
> src/XIHierarchy.c         |    3 +++
> 2 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/man/XIChangeHierarchy.txt b/man/XIChangeHierarchy.txt
> index ac667bc..205f40f 100644
> --- a/man/XIChangeHierarchy.txt
> +++ b/man/XIChangeHierarchy.txt
> @@ -30,7 +30,8 @@ DESCRIPTION
>    XIChangeHierarchy modifies the device hierarchy by creating or
>    removing master devices or changing the attachment of slave
>    devices. If num_changes is non-zero, changes is an array of
> -   XIAnyHierarchyChangeInfo structures.
> +   XIAnyHierarchyChangeInfo structures. If num_changes is equal or less than
> +   zero, XIChangeHierarchy does nothing.
> 
>    XIChangeHierarchy processes changes in order, effective
>    immediately. If an error occurs, processing is aborted and the
> diff --git a/src/XIHierarchy.c b/src/XIHierarchy.c
> index d30ea29..09e6f93 100644
> --- a/src/XIHierarchy.c
> +++ b/src/XIHierarchy.c
> @@ -52,6 +52,9 @@ XIChangeHierarchy(Display* dpy,
>     if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1)
> 	return (NoSuchExtension);
> 
> +    if (num_changes <= 0)
> +        return Success;
> +
>     GetReq(XIChangeHierarchy, req);
>     req->reqType = info->codes->major_opcode;
>     req->ReqType = X_XIChangeHierarchy;
> -- 
> 1.7.4.4
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list