summaryrefslogtreecommitdiff
path: root/exa
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-11-15 05:41:54 -0800
committerKeith Packard <keithp@keithp.com>2014-01-12 10:14:49 -0800
commit00438c9f943b219ba33055969ae7f9ba07214b2a (patch)
treed7e00f3fb68ee8741d3a9678e417c21ee2f8419b /exa
parent6e51645b4796fc3a02206fefd416b84beb2fcdf7 (diff)
exa: Clean up warnings
Declare GC ops/funcs as const. Use 'typeof' in the 'swap' macro to capture the right type. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'exa')
-rw-r--r--exa/exa.c4
-rw-r--r--exa/exa_priv.h12
2 files changed, 12 insertions, 4 deletions
diff --git a/exa/exa.c b/exa/exa.c
index f8e499c2b..e96173353 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -620,8 +620,8 @@ exaCreateGC(GCPtr pGC)
swap(pExaScr, pScreen, CreateGC);
if ((ret = (*pScreen->CreateGC) (pGC))) {
- wrap(pExaGC, pGC, funcs, (GCFuncs *) &exaGCFuncs);
- wrap(pExaGC, pGC, ops, (GCOps *) &exaOps);
+ wrap(pExaGC, pGC, funcs, &exaGCFuncs);
+ wrap(pExaGC, pGC, ops, &exaOps);
}
swap(pExaScr, pScreen, CreateGC);
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 1f5605687..aba3934fa 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -248,11 +248,19 @@ extern DevPrivateKeyRec exaScreenPrivateKeyRec;
real->mem = priv->Saved##mem; \
}
+#ifdef HAVE_TYPEOF
+#define swap(priv, real, mem) {\
+ typeof(real->mem) tmp = priv->Saved##mem; \
+ priv->Saved##mem = real->mem; \
+ real->mem = tmp; \
+}
+#else
#define swap(priv, real, mem) {\
void *tmp = priv->Saved##mem; \
priv->Saved##mem = real->mem; \
real->mem = tmp; \
}
+#endif
#define EXA_PRE_FALLBACK(_screen_) \
ExaScreenPriv(_screen_); \
@@ -333,8 +341,8 @@ typedef struct {
typedef struct {
/* GC values from the layer below. */
- GCOps *Savedops;
- GCFuncs *Savedfuncs;
+ const GCOps *Savedops;
+ const GCFuncs *Savedfuncs;
} ExaGCPrivRec, *ExaGCPrivPtr;
typedef struct {