Skip to content

Commit

Permalink
dix: Fix logic for displaying deprecation warning only once.
Browse files Browse the repository at this point in the history
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.

Reviewed-by: Jamey Sharp <[email protected]>
Signed-off-by: Cyril Brulebois <[email protected]>
  • Loading branch information
Cyril Brulebois committed Dec 7, 2010
1 parent a937803 commit 9f9c732
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dix/deprecated.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -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;
Expand All @@ -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");
Expand All @@ -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");
Expand Down

0 comments on commit 9f9c732

Please sign in to comment.