[PATCH:libXt 2/6] Avoid shadowing variables.

Thomas Klausner wiz at NetBSD.org
Tue Jun 25 14:02:46 PDT 2013


---
 src/Composite.c | 10 +++++-----
 src/Convert.c   |  2 +-
 src/Geometry.c  |  8 ++++----
 src/Intrinsic.c |  6 +++---
 src/NextEvent.c |  1 -
 src/Object.c    | 16 ++++++++--------
 src/Selection.c |  1 -
 src/TMaction.c  | 10 +++++-----
 8 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/src/Composite.c b/src/Composite.c
index 29893d8..ef77e53 100644
--- a/src/Composite.c
+++ b/src/Composite.c
@@ -175,17 +175,17 @@ static void InheritAllowsChangeManagedSet(
 }
 
 static void CompositeClassPartInitialize(
-	WidgetClass widgetClass)
+	WidgetClass cwidgetClass)
 {
     register CompositePartPtr wcPtr;
     register CompositePartPtr superPtr = NULL;
 
     wcPtr = (CompositePartPtr)
-	&(((CompositeWidgetClass)widgetClass)->composite_class);
+	&(((CompositeWidgetClass)cwidgetClass)->composite_class);
 
-    if (widgetClass != compositeWidgetClass)
+    if (cwidgetClass != compositeWidgetClass)
 	/* don't compute possible bogus pointer */
-	superPtr = (CompositePartPtr)&(((CompositeWidgetClass)widgetClass
+	superPtr = (CompositePartPtr)&(((CompositeWidgetClass)cwidgetClass
 			->core_class.superclass)->composite_class);
 
     /* We don't need to check for null super since we'll get to composite
@@ -200,7 +200,7 @@ static void CompositeClassPartInitialize(
     if (wcPtr->change_managed == XtInheritChangeManaged) {
 	wcPtr->change_managed =
 		superPtr->change_managed;
-	InheritAllowsChangeManagedSet(widgetClass);
+	InheritAllowsChangeManagedSet(cwidgetClass);
     }
 
     if (wcPtr->insert_child == XtInheritInsertChild) {
diff --git a/src/Convert.c b/src/Convert.c
index cea8fd3..bbb8ff1 100644
--- a/src/Convert.c
+++ b/src/Convert.c
@@ -812,7 +812,7 @@ CallConverter(
 	unsigned int supplied_size = to->size;
 	Boolean do_ref = cP->do_ref_count && cache_ref_return;
 	Boolean do_free = False;
-	Boolean retval =
+	retval =
 	    (*(XtTypeConverter)converter)(dpy, args, &num_args, from, to, &closure);
 
 	if (retval == False && supplied_size < to->size) {
diff --git a/src/Geometry.c b/src/Geometry.c
index d64c8e2..6f95d44 100644
--- a/src/Geometry.c
+++ b/src/Geometry.c
@@ -726,10 +726,10 @@ void XtTranslateCoords(
                 "Widget has no shell ancestor",
 		(String *)NULL, (Cardinal *)NULL);
     else {
-	Position x, y;
-	_XtShellGetCoordinates( w, &x, &y );
-	*rootx += x + w->core.border_width;
-	*rooty += y + w->core.border_width;
+	Position px, py;
+	_XtShellGetCoordinates( w, &px, &py );
+	*rootx += px + w->core.border_width;
+	*rooty += py + w->core.border_width;
     }
     UNLOCK_APP(app);
 }
diff --git a/src/Intrinsic.c b/src/Intrinsic.c
index 29bf716..7783050 100644
--- a/src/Intrinsic.c
+++ b/src/Intrinsic.c
@@ -88,7 +88,7 @@ String XtCXtToolkitError = "XtToolkitError";
 
 Boolean XtIsSubclass(
     Widget    widget,
-    WidgetClass widgetClass)
+    WidgetClass xwidgetClass)
 {
     register WidgetClass w;
     Boolean retval = FALSE;
@@ -97,7 +97,7 @@ Boolean XtIsSubclass(
     LOCK_APP(app);
     LOCK_PROCESS;
     for (w = widget->core.widget_class; w != NULL; w = w->core_class.superclass)
-	if (w == widgetClass) {
+	if (w == xwidgetClass) {
 	    retval = TRUE;
 	    break;
 	}
@@ -125,7 +125,7 @@ Boolean _XtCheckSubclassFlag(
 
 Boolean _XtIsSubclassOf(
     Widget object,
-    WidgetClass widgetClass,
+    WidgetClass xwidgetClass,
     WidgetClass superClass,
     _XtXtEnum flag)
 {
diff --git a/src/NextEvent.c b/src/NextEvent.c
index 4f2dcfb..c6fbcf1 100644
--- a/src/NextEvent.c
+++ b/src/NextEvent.c
@@ -272,7 +272,6 @@ static void InitFds (
 	wf->fdlistlen = wf->num_dpys = 0;
 
     if (!ignoreInputs && app->input_list != NULL) {
-	int ii;
 	for (ii = 0; ii < (int) app->input_max; ii++)
 	    if (app->input_list[ii] != NULL)
 		wf->fdlistlen++;
diff --git a/src/Object.c b/src/Object.c
index ae1ac75..3626aba 100644
--- a/src/Object.c
+++ b/src/Object.c
@@ -130,7 +130,7 @@ externaldef(objectClass) WidgetClass objectClass
 
 
 static void ConstructCallbackOffsets(
-    WidgetClass widgetClass)
+    WidgetClass cwidgetClass)
 {
     static XrmQuark QCallback = NULLQUARK;
     register int i;
@@ -138,7 +138,7 @@ static void ConstructCallbackOffsets(
     register CallbackTable newTable;
     register CallbackTable superTable;
     register XrmResourceList resourceList;
-    ObjectClass objectClass = (ObjectClass)widgetClass;
+    ObjectClass cobjectClass = (ObjectClass)cwidgetClass;
 
     /*
       This function builds an array of pointers to the resource
@@ -150,9 +150,9 @@ static void ConstructCallbackOffsets(
     if (QCallback == NULLQUARK)
 	QCallback = XrmPermStringToQuark(XtRCallback);
 
-    if (objectClass->object_class.superclass != NULL) {
+    if (cobjectClass->object_class.superclass != NULL) {
 	superTable = (CallbackTable)
-	    ((ObjectClass) objectClass->object_class.superclass)->
+	    ((ObjectClass) cobjectClass->object_class.superclass)->
 		object_class.callback_private;
 	tableSize = (int)(long) superTable[0];
     } else {
@@ -161,8 +161,8 @@ static void ConstructCallbackOffsets(
     }
 
     /* Count the number of callbacks */
-    resourceList = (XrmResourceList) objectClass->object_class.resources;
-    for (i = objectClass->object_class.num_resources; --i >= 0; resourceList++)
+    resourceList = (XrmResourceList) cobjectClass->object_class.resources;
+    for (i = cobjectClass->object_class.num_resources; --i >= 0; resourceList++)
 	if (resourceList->xrm_type == QCallback)
 	    tableSize++;
 
@@ -178,7 +178,7 @@ static void ConstructCallbackOffsets(
 
     if (superTable)
 	tableSize -= (int)(long) superTable[0];
-    resourceList = (XrmResourceList) objectClass->object_class.resources;
+    resourceList = (XrmResourceList) cobjectClass->object_class.resources;
     for (i=1; tableSize > 0; resourceList++)
 	if (resourceList->xrm_type == QCallback) {
 	    newTable[i++] = resourceList;
@@ -190,7 +190,7 @@ static void ConstructCallbackOffsets(
 	    --tableSize >= 0; superTable++)
 	    newTable[i++] = *superTable;
 
-    objectClass->object_class.callback_private = (XtPointer) newTable;
+    cobjectClass->object_class.callback_private = (XtPointer) newTable;
 }
 
 static void InheritObjectExtensionMethods(
diff --git a/src/Selection.c b/src/Selection.c
index 4f59d70..2b794d7 100644
--- a/src/Selection.c
+++ b/src/Selection.c
@@ -2079,7 +2079,6 @@ void XtSendSelectionRequest(
 	Boolean ins[PREALLOCED];
 	Atom *props;
 	Atom p[PREALLOCED];
-	int i = 0;
 	int j = 0;
 
 	/* Allocate */
diff --git a/src/TMaction.c b/src/TMaction.c
index 7af75ad..e4a5864 100644
--- a/src/TMaction.c
+++ b/src/TMaction.c
@@ -1041,14 +1041,14 @@ void XtCallActionProc(
     }
 
     {
-	String params[2];
-	Cardinal num_params = 2;
-	params[0] = (String)action;
-	params[1] = XtName(widget);
+	String sparams[2];
+	Cardinal num_sparams = 2;
+	sparams[0] = (String)action;
+	sparams[1] = XtName(widget);
 	XtAppWarningMsg(app,
 			"noActionProc", "xtCallActionProc", XtCXtToolkitError,
 			"No action proc named \"%s\" is registered for widget \"%s\"",
-			params, &num_params
+			sparams, &num_sparams
 			);
     }
     UNLOCK_APP(app);
-- 
1.8.3.1



More information about the xorg-devel mailing list