OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc_cliopt.c versions 1.7 and 1.8
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc_cliopt.c 1.7 -> 1.8

--- rc_cliopt.c  2002/04/24 16:47:07     1.7
+++ rc_cliopt.c  2002/04/25 16:17:57     1.8
@@ -180,19 +180,20 @@
 
 rc_return_t clioptSetsec(const char *pkszSec[])
 {
-    int i = 0;
+    int nSecs  = 0;
+    int nIndex = 0;
 
     if (m_pszSec)                                    /* Forbid overwriting */
         return(RC_THROW(RC_ERR_USE));                /* an existing rcfile */
     else if (pkszSec) {
-        for (i = 0; pkszSec[i]; i++);                /* Count the sections */
-        m_pszSec = malloc(sizeof (char **) * i + 1); /* Allocate using i   */
+        for (nSecs = 0; pkszSec[nSecs]; nSecs++);    /* Count the sections */
+        m_pszSec = malloc(sizeof (char **) * nSecs + 1);
 
-        for (i = 0; pkszSec[i]; i++) {
-            m_pszSec[i] = malloc(strlen(pkszSec[i]));
-            memcpy(m_pszSec[i], pkszSec[i], strlen(pkszSec[i]));
+        for (nIndex = 0; pkszSec[nIndex]; nIndex++) {
+            m_pszSec[nIndex] = malloc(strlen(pkszSec[nIndex]));
+            memcpy(m_pszSec[nIndex], pkszSec[nIndex], strlen(pkszSec[nIndex]));
         }
-        m_pszSec[i] = NULL; /* Used later for finding the end of array */
+        m_pszSec[nIndex] = NULL; /* Used later to find the end of the array */
     }
     else
         return(RC_THROW(RC_ERR_USE));   /* Incoming sections are NULL? */

CVSTrac 2.0.1