[PATCH 2/4] Delare all GCOps and GCFuncs tables const.

Jamey Sharp jamey at minilop.net
Tue Jul 13 15:55:39 PDT 2010


This changes only declarations as the globally allocated tables were
never supposed to be modified anyway.

Technically this is an API change for XAA, though ABI is preserved, but
there better not have been anybody modifying the XAA fallbacks table.
They'd deserve whatever they get.

Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
 Xext/panoramiX.c                   |    2 +-
 hw/dmx/dmxgc.c                     |    4 ++--
 hw/xfree86/common/xf86VGAarbiter.c |    4 ++--
 hw/xfree86/shadowfb/shadow.c       |    6 +++---
 hw/xfree86/xaa/xaaFallback.c       |    4 ++--
 hw/xfree86/xaa/xaaGC.c             |    6 +++---
 hw/xfree86/xaa/xaalocal.h          |    6 +++---
 hw/xnest/GC.c                      |    4 ++--
 hw/xquartz/xpr/driWrap.c           |    2 +-
 miext/cw/cw.c                      |    2 +-
 miext/cw/cw_ops.c                  |    2 +-
 miext/damage/damage.c              |    6 +++---
 miext/rootless/rootlessGC.c        |    4 ++--
 13 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 58282d2..bbf535c 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -127,7 +127,7 @@ static void XineramaChangeClip(GCPtr, int, pointer, int);
 static void XineramaDestroyClip(GCPtr);
 static void XineramaCopyClip(GCPtr, GCPtr);
 
-static GCFuncs XineramaGCFuncs = {
+static const GCFuncs XineramaGCFuncs = {
     XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
     XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
 };
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index 829200e..43b4301 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -49,7 +49,7 @@
 #include "pixmapstr.h"
 #include "migc.h"
 
-static GCFuncs dmxGCFuncs = {
+static const GCFuncs dmxGCFuncs = {
     dmxValidateGC,
     dmxChangeGC,
     dmxCopyGC,
@@ -59,7 +59,7 @@ static GCFuncs dmxGCFuncs = {
     dmxCopyClip,
 };
 
-static GCOps dmxGCOps = {
+static const GCOps dmxGCOps = {
     dmxFillSpans,
     dmxSetSpans,
     dmxPutImage,
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index 89f11fa..b28c870 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -39,13 +39,13 @@
 #include "pciaccess.h"
 
 
-static GCFuncs VGAarbiterGCFuncs = {
+static const GCFuncs VGAarbiterGCFuncs = {
     VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC,
     VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip,
     VGAarbiterCopyClip
 };
 
-static GCOps VGAarbiterGCOps = {
+static const GCOps VGAarbiterGCOps = {
     VGAarbiterFillSpans, VGAarbiterSetSpans, VGAarbiterPutImage,
     VGAarbiterCopyArea, VGAarbiterCopyPlane, VGAarbiterPolyPoint,
     VGAarbiterPolylines, VGAarbiterPolySegment, VGAarbiterPolyRectangle,
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 151e595..71604c9 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -416,13 +416,13 @@ static void ShadowChangeClip(GCPtr, int, pointer, int);
 static void ShadowDestroyClip(GCPtr);
 static void ShadowCopyClip(GCPtr, GCPtr);
 
-GCFuncs ShadowGCFuncs = {
+const GCFuncs ShadowGCFuncs = {
     ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC,
     ShadowChangeClip, ShadowDestroyClip, ShadowCopyClip
 };
 
 
-extern GCOps ShadowGCOps;
+extern const GCOps ShadowGCOps;
 
 static Bool
 ShadowCreateGC(GCPtr pGC)
@@ -1719,7 +1719,7 @@ ShadowPushPixels(
 }
 
 
-GCOps ShadowGCOps = {
+const GCOps ShadowGCOps = {
     ShadowFillSpans, ShadowSetSpans, 
     ShadowPutImage, ShadowCopyArea, 
     ShadowCopyPlane, ShadowPolyPoint, 
diff --git a/hw/xfree86/xaa/xaaFallback.c b/hw/xfree86/xaa/xaaFallback.c
index deeadbf..f9c78d3 100644
--- a/hw/xfree86/xaa/xaaFallback.c
+++ b/hw/xfree86/xaa/xaaFallback.c
@@ -332,7 +332,7 @@ XAAPushPixelsFallback(
     XAA_GC_OP_EPILOGUE(pGC);
 }
 
-GCOps XAAFallbackOps = {
+const GCOps XAAFallbackOps = {
     XAAFillSpansFallback, XAASetSpansFallback, 
     XAAPutImageFallback, XAACopyAreaFallback, 
     XAACopyPlaneFallback, XAAPolyPointFallback, 
@@ -345,7 +345,7 @@ GCOps XAAFallbackOps = {
     XAAPolyGlyphBltFallback, XAAPushPixelsFallback,
 };
 
-GCOps *XAAGetFallbackOps(void)
+const GCOps *XAAGetFallbackOps(void)
 {
     return &XAAFallbackOps;
 }
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index 44d50e6..e434910 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -27,7 +27,7 @@ static void XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
 static void XAADestroyClip(GCPtr pGC);
 static void XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 
-GCFuncs XAAGCFuncs = {
+const GCFuncs XAAGCFuncs = {
     XAAValidateGC, XAAChangeGC, XAACopyGC, XAADestroyGC,
     XAAChangeClip, XAADestroyClip, XAACopyClip
 };
@@ -47,7 +47,7 @@ XAACreateGC(GCPtr pGC)
     if((ret = (*pScreen->CreateGC)(pGC))) {	
 	pGCPriv->wrapOps = NULL;
 	pGCPriv->wrapFuncs = pGC->funcs;
-	pGCPriv->XAAOps = &XAAFallbackOps;
+	pGCPriv->XAAOps = (GCOps *) &XAAFallbackOps;
 	pGC->funcs = &XAAGCFuncs;
     }
  
@@ -154,7 +154,7 @@ XAAValidateGC(
     /* If our Ops are still the default ones we need to allocate new ones */
     if(pGC->ops == &XAAFallbackOps) {
 	if(!(pGCPriv->XAAOps = malloc(sizeof(GCOps)))) {
-	    pGCPriv->XAAOps = &XAAFallbackOps;
+	    pGCPriv->XAAOps = (GCOps *) &XAAFallbackOps;
 	    return;
 	}
 	/* make a modifiable copy of the default ops */
diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h
index 054f1de..80508da 100644
--- a/hw/xfree86/xaa/xaalocal.h
+++ b/hw/xfree86/xaa/xaalocal.h
@@ -1623,9 +1623,9 @@ XAAGetPixelFromRGBA (
 );
 
 /* XXX should be static */
-extern _X_EXPORT GCOps XAAFallbackOps;
-extern _X_EXPORT GCOps *XAAGetFallbackOps(void);
-extern _X_EXPORT GCFuncs XAAGCFuncs;
+extern _X_EXPORT const GCOps XAAFallbackOps;
+extern _X_EXPORT const GCOps *XAAGetFallbackOps(void);
+extern _X_EXPORT const GCFuncs XAAGCFuncs;
 extern _X_EXPORT DevPrivateKey XAAGetScreenKey(void);
 extern _X_EXPORT DevPrivateKey XAAGetGCKey(void);
 extern _X_EXPORT DevPrivateKey XAAGetPixmapKey(void);
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index 48fe4dc..496272f 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -37,7 +37,7 @@ is" without express or implied warranty.
 
 DevPrivateKeyRec xnestGCPrivateKeyRec;
 
-static GCFuncs xnestFuncs = {
+static const GCFuncs xnestFuncs = {
   xnestValidateGC,
   xnestChangeGC,
   xnestCopyGC,
@@ -47,7 +47,7 @@ static GCFuncs xnestFuncs = {
   xnestCopyClip,
 };
 
-static GCOps xnestOps = {
+static const GCOps xnestOps = {
   xnestFillSpans,
   xnestSetSpans,
   xnestPutImage,
diff --git a/hw/xquartz/xpr/driWrap.c b/hw/xquartz/xpr/driWrap.c
index de5c4a2..f77795b 100644
--- a/hw/xquartz/xpr/driWrap.c
+++ b/hw/xquartz/xpr/driWrap.c
@@ -469,7 +469,7 @@ DRIPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
 }
 
 
-static GCOps driGCOps = {
+static const GCOps driGCOps = {
     DRIFillSpans,
     DRISetSpans,
     DRIPutImage,
diff --git a/miext/cw/cw.c b/miext/cw/cw.c
index 3da3bc3..89ec37c 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -68,7 +68,7 @@ cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 static void
 cwDestroyClip(GCPtr pGC);
 
-GCFuncs cwGCFuncs = {
+const GCFuncs cwGCFuncs = {
     cwValidateGC,
     cwChangeGC,
     cwCopyGC,
diff --git a/miext/cw/cw_ops.c b/miext/cw/cw_ops.c
index 9ae56cb..19bd797 100644
--- a/miext/cw/cw_ops.c
+++ b/miext/cw/cw_ops.c
@@ -109,7 +109,7 @@ static void cwPolyGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y,
 static void cwPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
 			 int w, int h, int x, int y);
 
-GCOps cwGCOps = {
+const GCOps cwGCOps = {
 	cwFillSpans,
 	cwSetSpans,
 	cwPutImage,
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 6b4c8ac..cf0462c 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -435,12 +435,12 @@ static void damageChangeClip(GCPtr, int, pointer, int);
 static void damageDestroyClip(GCPtr);
 static void damageCopyClip(GCPtr, GCPtr);
 
-static GCFuncs damageGCFuncs = {
+static const GCFuncs damageGCFuncs = {
     damageValidateGC, damageChangeGC, damageCopyGC, damageDestroyGC,
     damageChangeClip, damageDestroyClip, damageCopyClip
 };
 
-static GCOps damageGCOps;
+static const GCOps damageGCOps;
 
 static Bool
 damageCreateGC(GCPtr pGC)
@@ -1749,7 +1749,7 @@ damageCopyWindow(WindowPtr	pWindow,
     wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow);
 }
 
-static GCOps damageGCOps = {
+static const GCOps damageGCOps = {
     damageFillSpans, damageSetSpans,
     damagePutImage, damageCopyArea,
     damageCopyPlane, damagePolyPoint,
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index 6af8d85..483b3ae 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -63,7 +63,7 @@ static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 
 Bool RootlessCreateGC(GCPtr pGC);
 
-GCFuncs rootlessGCFuncs = {
+const GCFuncs rootlessGCFuncs = {
     RootlessValidateGC,
     RootlessChangeGC,
     RootlessCopyGC,
@@ -124,7 +124,7 @@ static void RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst,
 			       int dx, int dy, int xOrg, int yOrg);
 
 
-static GCOps rootlessGCOps = {
+static const GCOps rootlessGCOps = {
     RootlessFillSpans,
     RootlessSetSpans,
     RootlessPutImage,
-- 
1.7.0



More information about the xorg-devel mailing list