[PATCH] 5/5 various cleanups

Warren Turkal wt@midsouth.rr.com
Thu, 12 Feb 2004 01:11:26 -0600


This is the first of 5 cleanup patches I have made. I don't think these
patches conflict, but it would be best to apply them in numerical order.

wt

This removes some instances of NeedFunctionPrototypes I found in the code.

diff -Nru3 xserver-old/dix/events.c xserver/dix/events.c
--- xserver-old/dix/events.c    2004-02-12 00:50:53.000000000 -0600
+++ xserver/dix/events.c        2004-02-12 00:54:13.000000000 -0600
@@ -93,11 +93,7 @@
 
 #ifdef XKB
 #include "XKBsrv.h"
-#if NeedFunctionPrototypes
 extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
-#else
-extern Bool XkbFilterEvents();
-#endif
 #endif
 
 #ifdef XCSECURITY
@@ -205,18 +201,14 @@
 } sprite;                      /* info about the cursor sprite */
 
 static void DoEnterLeaveEvents(
-#if NeedFunctionPrototypes
     WindowPtr /*fromWin*/,
     WindowPtr /*toWin*/,
     int /*mode*/
-#endif
 );
 
 static WindowPtr XYToWindow(
-#if NeedFunctionPrototypes
     int /*x*/,
     int /*y*/
-#endif
 );
 
 extern int lastEvent;
@@ -614,12 +606,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 SyntheticMotion(int x, int y)
-#else
-SyntheticMotion(x, y)
-    int x, y;
-#endif
 {
     xEvent xE;
 
@@ -643,13 +630,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 ConfineToShape(RegionPtr shape, int *px, int *py)
-#else
-ConfineToShape(shape, px, py)
-    RegionPtr shape;
-    int *px, *py;
-#endif
 {
     BoxRec box;
     int x = *px, y = *py;
@@ -685,19 +666,11 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 CheckPhysLimits(
     CursorPtr cursor,
     Bool generateEvents,
     Bool confineToScreen,
     ScreenPtr pScreen)
-#else
-CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen)
-    CursorPtr cursor;
-    Bool generateEvents;
-    Bool confineToScreen;
-    ScreenPtr pScreen;
-#endif
 {
     HotSpot new;
 
@@ -736,15 +709,9 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 CheckVirtualMotion(
     register QdEventPtr qe,
     register WindowPtr pWin)
-#else
-CheckVirtualMotion(qe, pWin)
-    register QdEventPtr qe;
-    register WindowPtr pWin;
-#endif
 {
 #ifdef PANORAMIX
     if(!noPanoramiXExtension) {
@@ -824,12 +791,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 ChangeToCursor(CursorPtr cursor)
-#else
-ChangeToCursor(cursor)
-    CursorPtr cursor;
-#endif
 {
 #ifdef PANORAMIX
     if(!noPanoramiXExtension) {
@@ -861,11 +823,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 PostNewCursor(void)
-#else
-PostNewCursor()
-#endif
 {
     register    WindowPtr win;
     register    GrabPtr grab = inputInfo.pointer->grab;
@@ -935,12 +893,7 @@
 #define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
 
 static void
-#if NeedFunctionPrototypes
 MonthChangedOrBadTime(register xEvent *xE)
-#else
-MonthChangedOrBadTime(xE)
-    register xEvent *xE;
-#endif
 {
     /* If the ddx/OS is careless about not processing timestamped events
from
      * different sources in sorted order, then it's possible for time to go
@@ -1048,11 +1001,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 PlayReleasedEvents(void)
-#else
-PlayReleasedEvents()
-#endif
 {
     register QdEventPtr *prev, qe;
     register DeviceIntPtr dev;
@@ -1099,13 +1048,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 FreezeThaw(register DeviceIntPtr dev, Bool frozen)
-#else
-FreezeThaw(dev, frozen)
-    register DeviceIntPtr dev;
-    Bool frozen;
-#endif
 {
     dev->sync.frozen = frozen;
     if (frozen)
@@ -1774,19 +1717,11 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 FixUpEventFromWindow(
     xEvent *xE,
     WindowPtr pWin,
     Window child,
     Bool calcChild)
-#else
-FixUpEventFromWindow(xE, pWin, child, calcChild)
-    xEvent *xE;
-    WindowPtr pWin;
-    Window child;
-    Bool calcChild;
-#endif
 {
     if (calcChild)
     {
@@ -1970,12 +1905,7 @@
 }
 
 static WindowPtr 
-#if NeedFunctionPrototypes
 XYToWindow(int x, int y)
-#else
-XYToWindow(x, y)
-       int x, y;
-#endif
 {
     register WindowPtr  pWin;
 
@@ -2015,12 +1945,7 @@
 }
 
 static Bool
-#if NeedFunctionPrototypes
 CheckMotion(xEvent *xE)
-#else
-CheckMotion(xE)
-    xEvent *xE;
-#endif
 {
     WindowPtr prevSpriteWin = sprite.win;
 
@@ -2399,19 +2324,11 @@
        passive grab set on the window to be activated. */
 
 static Bool
-#if NeedFunctionPrototypes
 CheckPassiveGrabsOnWindow(
     WindowPtr pWin,
     register DeviceIntPtr device,
     register xEvent *xE,
     int count)
-#else
-CheckPassiveGrabsOnWindow(pWin, device, xE, count)
-    WindowPtr pWin;
-    register DeviceIntPtr device;
-    register xEvent *xE;
-    int count;
-#endif
 {
     register GrabPtr grab = wPassiveGrabs(pWin);
     GrabRec tempGrab;
@@ -3145,14 +3062,9 @@
 }
 
 static WindowPtr 
-#if NeedFunctionPrototypes
 CommonAncestor(
     register WindowPtr a,
     register WindowPtr b)
-#else
-CommonAncestor(a, b)
-    register WindowPtr a, b;
-#endif
 {
     for (b = b->parent; b; b = b->parent)
        if (IsParent(b, a)) return b;
@@ -3160,19 +3072,12 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 EnterLeaveEvent(
     int type,
     int mode,
     int detail,
     register WindowPtr pWin,
     Window child)
-#else
-EnterLeaveEvent(type, mode, detail, pWin, child)
-    int type, mode, detail;
-    register WindowPtr pWin;
-    Window child;
-#endif
 {
     xEvent             event;
     register DeviceIntPtr keybd = inputInfo.keyboard;
@@ -3253,13 +3158,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
-#else
-EnterNotifies(ancestor, child, mode, detail)
-    WindowPtr ancestor, child;
-    int mode, detail;
-#endif
 {
     WindowPtr  parent = child->parent;
 
@@ -3270,13 +3169,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
-#else
-LeaveNotifies(child, ancestor, mode, detail)
-    WindowPtr child, ancestor;
-    int detail, mode;
-#endif
 {
     register WindowPtr  pWin;
 
@@ -3290,13 +3183,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode)
-#else
-DoEnterLeaveEvents(fromWin, toWin, mode)
-    WindowPtr fromWin, toWin;
-    int mode;
-#endif
 {
     if (fromWin == toWin)
        return;
@@ -3324,14 +3211,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register
WindowPtr pWin)
-#else
-FocusEvent(dev, type, mode, detail, pWin)
-    DeviceIntPtr dev;
-    int type, mode, detail;
-    register WindowPtr pWin;
-#endif
 {
     xEvent event;
 
@@ -3372,19 +3252,11 @@
   * no-op if child not descended from ancestor
   */
 static Bool
-#if NeedFunctionPrototypes
 FocusInEvents(
     DeviceIntPtr dev,
     WindowPtr ancestor, WindowPtr child, WindowPtr skipChild,
     int mode, int detail,
     Bool doAncestor)
-#else
-FocusInEvents(dev, ancestor, child, skipChild, mode, detail, doAncestor)
-    DeviceIntPtr dev;
-    WindowPtr ancestor, child, skipChild;
-    int mode, detail;
-    Bool doAncestor;
-#endif
 {
     if (child == NullWindow)
        return ancestor == NullWindow;
@@ -3406,20 +3278,11 @@
 
 /* dies horribly if ancestor is not an ancestor of child */
 static void
-#if NeedFunctionPrototypes
 FocusOutEvents(
     DeviceIntPtr dev,
     WindowPtr child, WindowPtr ancestor,
     int mode, int detail,
     Bool doAncestor)
-#else
-FocusOutEvents(dev, child, ancestor, mode, detail, doAncestor)
-    DeviceIntPtr dev;
-    WindowPtr child, ancestor;
-    int mode;
-    int detail;
-    Bool doAncestor;
-#endif
 {
     register WindowPtr  pWin;
 
@@ -3559,7 +3422,6 @@
 }
 
 int
-#if NeedFunctionPrototypes
 SetInputFocus(
     ClientPtr client,
     DeviceIntPtr dev,
@@ -3567,15 +3429,6 @@
     CARD8 revertTo,
     Time ctime,
     Bool followOK)
-#else
-SetInputFocus(client, dev, focusID, revertTo, ctime, followOK)
-    ClientPtr client;
-    DeviceIntPtr dev;
-    Window focusID;
-    CARD8 revertTo;
-    Time ctime;
-    Bool followOK;
-#endif
 {
     register FocusClassPtr focus;
     register WindowPtr focusWin;
diff -Nru3 xserver-old/dix/window.c xserver/dix/window.c
--- xserver-old/dix/window.c    2004-02-12 00:50:53.000000000 -0600
+++ xserver/dix/window.c        2004-02-12 00:56:36.000000000 -0600
@@ -135,10 +135,8 @@
 #endif
 
 static Bool TileScreenSaver(
-#if NeedFunctionPrototypes
     int /*i*/,
     int /*kind*/
-#endif
 );
 
 
@@ -263,12 +261,7 @@
 Bool   disableSaveUnders = FALSE;
 
 static void
-#if NeedFunctionPrototypes
 SetWindowToDefaults(register WindowPtr pWin)
-#else
-SetWindowToDefaults(pWin)
-    register WindowPtr pWin;
-#endif
 {
     pWin->prevSib = NullWindow;
     pWin->firstChild = NullWindow;
@@ -306,12 +299,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 MakeRootTile(WindowPtr pWin)
-#else
-MakeRootTile(pWin)
-    WindowPtr pWin;
-#endif
 {
     ScreenPtr pScreen = pWin->drawable.pScreen;
     GCPtr pGC;
@@ -824,12 +812,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 FreeWindowResources(register WindowPtr pWin)
-#else
-FreeWindowResources(pWin)
-    register WindowPtr pWin;
-#endif
 {
     register ScreenPtr pScreen = pWin->drawable.pScreen;
 
@@ -856,12 +839,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 CrushTree(WindowPtr pWin)
-#else
-CrushTree(pWin)
-    WindowPtr pWin;
-#endif
 {
     register WindowPtr pChild, pSib, pParent;
     UnrealizeWindowProcPtr UnrealizeWindow;
@@ -1896,14 +1874,9 @@
  */
 
 static int
-#if NeedFunctionPrototypes
 IsSiblingAboveMe(
     register WindowPtr pMe,
     register WindowPtr pSib)
-#else
-IsSiblingAboveMe(pMe, pSib)
-    register WindowPtr pMe, pSib;
-#endif
 {
     register WindowPtr pWin;
 
@@ -1920,15 +1893,9 @@
 }
 
 static BoxPtr
-#if NeedFunctionPrototypes
 WindowExtents(
     register WindowPtr pWin,
     register BoxPtr pBox)
-#else
-WindowExtents(pWin, pBox)
-    register WindowPtr pWin;
-    register BoxPtr pBox;
-#endif
 {
     pBox->x1 = pWin->drawable.x - wBorderWidth (pWin);
     pBox->y1 = pWin->drawable.y - wBorderWidth (pWin);
@@ -1942,15 +1909,9 @@
 #define IS_SHAPED(pWin)        (wBoundingShape (pWin) != (RegionPtr) NULL)
 
 static RegionPtr
-#if NeedFunctionPrototypes
 MakeBoundingRegion (
     register WindowPtr pWin,
     BoxPtr     pBox)
-#else
-MakeBoundingRegion (pWin, pBox)
-    register WindowPtr pWin;
-    BoxPtr     pBox;
-#endif
 {
     RegionPtr  pRgn;
     REGION_PTR(pScreen, pWin)
@@ -1967,17 +1928,11 @@
 }
 
 static Bool
-#if NeedFunctionPrototypes
 ShapeOverlap (
     WindowPtr  pWin,
     BoxPtr     pWinBox,
     WindowPtr  pSib,
     BoxPtr     pSibBox)
-#else
-ShapeOverlap (pWin, pWinBox, pSib, pSibBox)
-    WindowPtr  pWin, pSib;
-    BoxPtr     pWinBox, pSibBox;
-#endif
 {
     RegionPtr  pWinRgn, pSibRgn;
     register ScreenPtr pScreen;
@@ -1996,16 +1951,10 @@
 }
 
 static Bool
-#if NeedFunctionPrototypes
 AnyWindowOverlapsMe(
     WindowPtr pWin,
     WindowPtr pHead,
     register BoxPtr box)
-#else
-AnyWindowOverlapsMe(pWin, pHead, box)
-    WindowPtr pWin, pHead;
-    register BoxPtr box;
-#endif
 {
     register WindowPtr pSib;
     BoxRec sboxrec;
@@ -2026,15 +1975,9 @@
 }
 
 static Bool
-#if NeedFunctionPrototypes
 IOverlapAnyWindow(
     WindowPtr pWin,
     register BoxPtr box)
-#else
-IOverlapAnyWindow(pWin, box)
-    WindowPtr pWin;
-    register BoxPtr box;
-#endif
 {
     register WindowPtr pSib;
     BoxRec sboxrec;
@@ -2083,7 +2026,6 @@
  */
 
 static WindowPtr
-#if NeedFunctionPrototypes
 WhereDoIGoInTheStack(
     register WindowPtr pWin,
     register WindowPtr pSib,
@@ -2092,13 +2034,6 @@
     unsigned short w,
     unsigned short h,
     int smode)
-#else
-WhereDoIGoInTheStack(pWin, pSib, x, y, w, h, smode)
-    register WindowPtr pWin, pSib;
-    short x, y;
-    unsigned short w, h;
-    int smode;
-#endif
 {
     BoxRec box;
     register ScreenPtr pScreen;
@@ -2197,16 +2132,10 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 ReflectStackChange(
     register WindowPtr pWin,
     register WindowPtr pSib,
     VTKind  kind)
-#else
-ReflectStackChange(pWin, pSib, kind)
-    register WindowPtr pWin, pSib;
-    VTKind  kind;
-#endif
 {
 /* Note that pSib might be NULL */
 
@@ -2602,15 +2531,9 @@
 }
 
 static int
-#if NeedFunctionPrototypes
 CompareWIDs(
     WindowPtr pWin,
     pointer   value) /* must conform to VisitWindowProcPtr */
-#else
-CompareWIDs(pWin, value)
-    WindowPtr pWin;
-    pointer   value; /* must conform to VisitWindowProcPtr */
-#endif
 {
     Window *wid = (Window *)value;
 
@@ -2719,12 +2642,7 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 RealizeTree(WindowPtr pWin)
-#else
-RealizeTree(pWin)
-    WindowPtr pWin;
-#endif
 {
     register WindowPtr pChild;
     RealizeWindowProcPtr Realize;
@@ -3011,15 +2929,9 @@
 }
 
 static void
-#if NeedFunctionPrototypes
 UnrealizeTree(
     WindowPtr pWin,
     Bool fromConfigure)
-#else
-UnrealizeTree(pWin, fromConfigure)
-    WindowPtr pWin;
-    Bool fromConfigure;
-#endif
 {
     register WindowPtr pChild;
     UnrealizeWindowProcPtr Unrealize;
@@ -3424,9 +3336,7 @@
 
 #ifndef NOLOGOHACK
 static void DrawLogo(
-#if NeedFunctionPrototypes
     WindowPtr /*pWin*/
-#endif
 );
 #endif
 
@@ -3544,13 +3454,7 @@
 }
 
 static Bool
-#if NeedFunctionPrototypes
 TileScreenSaver(int i, int kind)
-#else
-TileScreenSaver(i, kind)
-    int i;
-    int        kind;
-#endif
 {
     int j;
     int result;
@@ -3814,12 +3718,7 @@
 
 #ifndef NOLOGOHACK
 static void
-#if NeedFunctionPrototypes
 DrawLogo(WindowPtr pWin)
-#else
-DrawLogo(pWin)
-    WindowPtr pWin;
-#endif
 {
     DrawablePtr pDraw;
     ScreenPtr pScreen;

-- 
Warren Turkal
President, GOLUM, Inc.
http://www.golum.org