[PATCH 2/2] dix: Fix logic for displaying deprecation warning only once.

Jamey Sharp jamey at minilop.net
Fri Nov 12 14:34:11 PST 2010


Yup, that looks good to me!

Reviewed-by: Jamey Sharp <jamey at minilop.net>

On Fri, Nov 12, 2010 at 12:43 PM, Cyril Brulebois <kibi at debian.org> wrote:
> As pointed out by Jamey Sharp (again), the logic is faulty: --warn is
> always going to be false. Replace it with warn-- accordingly, so that
> there's (at least, but also only) one warning showing up.
>
> Signed-off-by: Cyril Brulebois <kibi at debian.org>
> ---
>  dix/deprecated.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/dix/deprecated.c b/dix/deprecated.c
> index 4cf596a..f05588e 100644
> --- a/dix/deprecated.c
> +++ b/dix/deprecated.c
> @@ -67,7 +67,7 @@ SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode)
>     WindowPtr pWin;
>     static int warn = 1;
>     dixLookupWindow(&pWin, id, client, access_mode);
> -    if (warn > 0 && --warn)
> +    if (warn > 0 && warn--)
>        ErrorF("Warning: LookupWindow()/SecurityLookupWindow() "
>               "are deprecated.  Please convert your driver/module "
>               "to use dixLookupWindow().\n");
> @@ -88,7 +88,7 @@ SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode)
>     DrawablePtr pDraw;
>     static int warn = 1;
>     dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode);
> -    if (warn > 0 && --warn)
> +    if (warn > 0 && warn--)
>        ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() "
>               "are deprecated.  Please convert your driver/module "
>               "to use dixLookupDrawable().\n");
> @@ -109,7 +109,7 @@ LookupClient(XID id, ClientPtr client)
>     ClientPtr pClient;
>     static int warn = 1;
>     dixLookupClient(&pClient, id, client, DixUnknownAccess);
> -    if (warn > 0 && --warn)
> +    if (warn > 0 && warn--)
>        ErrorF("Warning: LookupClient() is deprecated.  Please convert your "
>               "driver/module to use dixLookupClient().\n");
>     return pClient;
> @@ -123,7 +123,7 @@ SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype,
>     pointer retval;
>     static int warn = 1;
>     dixLookupResourceByType(&retval, id, rtype, client, access_mode);
> -    if (warn > 0 && --warn)
> +    if (warn > 0 && warn--)
>        ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() "
>               "are deprecated.  Please convert your driver/module "
>               "to use dixLookupResourceByType().\n");
> @@ -137,7 +137,7 @@ SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes,
>     pointer retval;
>     static int warn = 1;
>     dixLookupResourceByClass(&retval, id, classes, client, access_mode);
> -    if (warn > 0 && --warn)
> +    if (warn > 0 && warn--)
>        ErrorF("Warning: LookupIDByClass()/SecurityLookupIDByClass() "
>               "are deprecated.  Please convert your driver/module "
>               "to use dixLookupResourceByClass().\n");
> --
> 1.7.2.3
>
>


More information about the xorg-devel mailing list