[PATCH:libxtrans 4/4] Rename index & stat variables to stop gcc -Wshadow warnings

Alan Coopersmith alan.coopersmith at oracle.com
Mon Dec 5 20:36:32 PST 2011


It doesn't like local variables with the same name as system library
functions.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 Xtranslcl.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/Xtranslcl.c b/Xtranslcl.c
index 2d0bdd5..ab5aa5a 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -1931,13 +1931,13 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host _X_UNUSED, char *por
 #ifdef TRANS_REOPEN
 
 static XtransConnInfo
-TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
+TRANS(LocalReopenServer)(int type, int tindex, int fd, char *port)
 
 {
     XtransConnInfo ciptr;
-    int stat = 0;
+    int status = 0;
 
-    prmsg(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd);
+    prmsg(2,"LocalReopenServer(%d,%d,%d)\n", type, tindex, fd);
 
     if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
     {
@@ -1951,19 +1951,19 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
     switch( type )
     {
     case XTRANS_OPEN_COTS_SERVER:
-	stat = LOCALtrans2devtab[index].devcotsreopenserver(ciptr,fd,port);
+	status = LOCALtrans2devtab[tindex].devcotsreopenserver(ciptr,fd,port);
 	break;
     case XTRANS_OPEN_CLTS_SERVER:
-	stat = LOCALtrans2devtab[index].devcltsreopenserver(ciptr,fd,port);
+	status = LOCALtrans2devtab[tindex].devcltsreopenserver(ciptr,fd,port);
 	break;
     default:
 	prmsg(1,"LocalReopenServer: Unknown Open type %d\n",
 	  type );
     }
 
-    if( stat > 0 ) {
-	ciptr->priv=(char *)&LOCALtrans2devtab[index];
-	ciptr->index=index;
+    if( status > 0 ) {
+	ciptr->priv=(char *)&LOCALtrans2devtab[tindex];
+	ciptr->index=tindex;
 	ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS);
 	return ciptr;
     }
@@ -2075,48 +2075,48 @@ static XtransConnInfo
 TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
 
 {
-    int index;
+    int tindex;
 
     prmsg(2,"LocalReopenCOTSServer(%d,%s)\n", fd, port);
 
-    for(index=1;index<NUMTRANSPORTS;index++)
+    for(tindex=1;tindex<NUMTRANSPORTS;tindex++)
     {
 	if( strcmp(thistrans->TransName,
-	    LOCALtrans2devtab[index].transname) == 0 )
+	    LOCALtrans2devtab[tindex].transname) == 0 )
 	    break;
     }
 
-    if (index >= NUMTRANSPORTS)
+    if (tindex >= NUMTRANSPORTS)
     {
 	return (NULL);
     }
 
     return TRANS(LocalReopenServer)(XTRANS_OPEN_COTS_SERVER,
-	index, fd, port);
+	tindex, fd, port);
 }
 
 static XtransConnInfo
 TRANS(LocalReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
 
 {
-    int index;
+    int tindex;
 
     prmsg(2,"LocalReopenCLTSServer(%d,%s)\n", fd, port);
 
-    for(index=1;index<NUMTRANSPORTS;index++)
+    for(tindex=1;tindex<NUMTRANSPORTS;tindex++)
     {
 	if( strcmp(thistrans->TransName,
-	    LOCALtrans2devtab[index].transname) == 0 )
+	    LOCALtrans2devtab[tindex].transname) == 0 )
 	    break;
     }
 
-    if (index >= NUMTRANSPORTS)
+    if (tindex >= NUMTRANSPORTS)
     {
 	return (NULL);
     }
 
     return TRANS(LocalReopenServer)(XTRANS_OPEN_CLTS_SERVER,
-	index, fd, port);
+	tindex, fd, port);
 }
 
 #endif /* TRANS_REOPEN */
-- 
1.7.3.2



More information about the xorg-devel mailing list