[Pcsclite-git-commit] [PCSC] 03/03: hotplug_libudev.c: rename i into index

Ludovic Rousseau rousseau at moszumanska.debian.org
Wed Nov 18 16:06:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository PCSC.

commit 415aa5316b6392df2a6d6ea1e4343663daf41f9b
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Wed Nov 18 17:04:50 2015 +0100

    hotplug_libudev.c: rename i into index
    
    To avoid reproducing the problem fixed in
    acb04f9ca3e20bde5290cd81f5091ca30b3e97db the variable i in renamed
    index. i is not a general/reusable variable.
---
 src/hotplug_libudev.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/hotplug_libudev.c b/src/hotplug_libudev.c
index 2ef7b0b..a8ba1b8 100644
--- a/src/hotplug_libudev.c
+++ b/src/hotplug_libudev.c
@@ -375,7 +375,7 @@ static void HPRemoveDevice(struct udev_device *dev)
 
 static void HPAddDevice(struct udev_device *dev)
 {
-	int i, a;
+	int index, a;
 	char *deviceName = NULL;
 	char *fullname = NULL;
 	struct _driverTracker *driver, *classdriver;
@@ -424,9 +424,9 @@ static void HPAddDevice(struct udev_device *dev)
 	}
 
 	/* check for duplicated add */
-	for (i=0; i<PCSCLITE_MAX_READERS_CONTEXTS; i++)
+	for (index=0; index<PCSCLITE_MAX_READERS_CONTEXTS; index++)
 	{
-		if (readerTracker[i].fullName && !strcmp(sysname, readerTracker[i].sysname))
+		if (readerTracker[index].fullName && !strcmp(sysname, readerTracker[index].sysname))
 			return;
 	}
 
@@ -447,16 +447,16 @@ static void HPAddDevice(struct udev_device *dev)
 	}
 
 	/* find a free entry */
-	for (i=0; i<PCSCLITE_MAX_READERS_CONTEXTS; i++)
+	for (index=0; index<PCSCLITE_MAX_READERS_CONTEXTS; index++)
 	{
-		if (NULL == readerTracker[i].fullName)
+		if (NULL == readerTracker[index].fullName)
 			break;
 	}
 
-	if (PCSCLITE_MAX_READERS_CONTEXTS == i)
+	if (PCSCLITE_MAX_READERS_CONTEXTS == index)
 	{
 		Log2(PCSC_LOG_ERROR,
-			"Not enough reader entries. Already found %d readers", i);
+			"Not enough reader entries. Already found %d readers", index);
 		return;
 	}
 
@@ -508,11 +508,11 @@ static void HPAddDevice(struct udev_device *dev)
 		}
 	}
 
-	readerTracker[i].fullName = strdup(fullname);
-	readerTracker[i].devpath = strdup(devpath);
-	readerTracker[i].sysname = strdup(sysname);
+	readerTracker[index].fullName = strdup(fullname);
+	readerTracker[index].devpath = strdup(devpath);
+	readerTracker[index].sysname = strdup(sysname);
 
-	ret = RFAddReader(fullname, PCSCLITE_HP_BASE_PORT + i,
+	ret = RFAddReader(fullname, PCSCLITE_HP_BASE_PORT + index,
 		driver->libraryPath, deviceName);
 	if ((SCARD_S_SUCCESS != ret) && (SCARD_E_UNKNOWN_READER != ret))
 	{
@@ -522,7 +522,7 @@ static void HPAddDevice(struct udev_device *dev)
 		if (classdriver && driver != classdriver)
 		{
 			/* the reader can also be used by the a class driver */
-			ret = RFAddReader(fullname, PCSCLITE_HP_BASE_PORT + i,
+			ret = RFAddReader(fullname, PCSCLITE_HP_BASE_PORT + index,
 				classdriver->libraryPath, deviceName);
 			if ((SCARD_S_SUCCESS != ret) && (SCARD_E_UNKNOWN_READER != ret))
 			{
@@ -540,12 +540,12 @@ static void HPAddDevice(struct udev_device *dev)
 	if (SCARD_S_SUCCESS != ret)
 	{
 		/* adding the reader failed */
-		free(readerTracker[i].devpath);
-		readerTracker[i].devpath = NULL;
-		free(readerTracker[i].fullName);
-		readerTracker[i].fullName = NULL;
-		free(readerTracker[i].sysname);
-		readerTracker[i].sysname = NULL;
+		free(readerTracker[index].devpath);
+		readerTracker[index].devpath = NULL;
+		free(readerTracker[index].fullName);
+		readerTracker[index].fullName = NULL;
+		free(readerTracker[index].sysname);
+		readerTracker[index].sysname = NULL;
 	}
 
 exit:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git



More information about the Pcsclite-cvs-commit mailing list