[Pcsclite-cvs-commit] r6500 - /trunk/PCSC/src/configfile.l

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Jan 15 17:42:14 UTC 2013


Author: rousseau
Date: Tue Jan 15 17:42:13 2013
New Revision: 6500

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6500
Log:
Move the variable declaration near there use site

Also
- change the type from int to size_t for strlen() results
- initialize the values in the for() loop

Modified:
    trunk/PCSC/src/configfile.l

Modified: trunk/PCSC/src/configfile.l
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/configfile.l?rev=6500&op=diff
==============================================================================
--- trunk/PCSC/src/configfile.l (original)
+++ trunk/PCSC/src/configfile.l Tue Jan 15 17:42:13 2013
@@ -68,10 +68,6 @@
 
 int evaluatetoken(char *pcToken)
 {
-	int channelId = 0;
-	int p = 0;
-	unsigned int n = 0;
-
 	if (pcPrevious == NULL)
 	{	/* This is the key */
 		pcPrevious = strdup(pcToken);
@@ -93,8 +89,10 @@
 		{
 			if (pcFriendlyname == NULL)
 			{
+				size_t n, p;
+
 				pcFriendlyname = malloc(strlen(pcCurrent) - 1);
-				for (n = 0; n < strlen(pcCurrent); n++)
+				for (n = 0, p = 0; n < strlen(pcCurrent); n++)
 				{
 					if (pcCurrent[n] != '"')
 					{	/* Strip off the quotes */
@@ -183,6 +181,8 @@
 	if (pcFriendlyname != NULL &&
 		pcLibpath != NULL && pcChannelid != NULL && badError != 1)
 	{
+		int channelId;
+
 		if (0 == reader_list_size)
 		{
 			/* one real reader and one end marker */




More information about the Pcsclite-cvs-commit mailing list