Mesa (master): Avoid a compiler warning about a potentially unused variable .

Carl Worth cworth at kemper.freedesktop.org
Wed Jul 28 17:45:11 UTC 2010


Module: Mesa
Branch: master
Commit: db011c8141d7b01b67f2ded4e634657b92ed707a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=db011c8141d7b01b67f2ded4e634657b92ed707a

Author: Carl Worth <cworth at cworth.org>
Date:   Wed Jul 28 10:42:46 2010 -0700

Avoid a compiler warning about a potentially unused variable.

There is no assignment to the "ret" variable if X_DRI2SwapBuffers is
not defined. In this case, the earlier explicit "return 0" is likely
to be used, but the compiler can't be sure of that, (nor can I for
that matter).

We cover this case by explicitly initializing "ret" to 0.

---

 src/glx/dri2_glx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 49c7ce7..a2c2b97 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -494,7 +494,7 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
     struct dri2_screen *psc = (struct dri2_screen *) priv->base.psc;
     struct dri2_display *pdp =
 	(struct dri2_display *)dpyPriv->dri2Display;
-    CARD64 ret;
+    CARD64 ret = 0;
 
 #ifdef __DRI2_FLUSH
     if (psc->f)




More information about the mesa-commit mailing list