OSSP CVS Repository

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

ossp-pkg/rc/rc_anal.c 1.9 -> 1.10

--- rc_anal.c    2002/08/01 08:55:05     1.9
+++ rc_anal.c    2002/08/01 09:45:19     1.10
@@ -64,6 +64,7 @@
     else { /* Only enter block with valid string, strdup can't handle NULL */
         (*ppInst)->m_szRcs = malloc(sizeof(char **));
         if (strcmp(kszName, RC_GLOB_WILD)) {
+            (*ppInst)->m_szRcs = malloc(sizeof(*((*ppInst)->m_szRcs)));
             *(*ppInst)->m_szRcs = strdup("rc."); /* FIXME: Remove hardcoded */
             strcat(*(*ppInst)->m_szRcs, kszName);
         }
@@ -184,8 +185,8 @@
 rc_return_t analGloblocs(rc_anal_t **ppInst)
 {
     struct dirent ***pppFiles = NULL;
-    int nIter  = 0;
-    int nCount = 0;
+    int nCount = 0; /* How many globbed files we find */
+    int nIter  = 0; /* Iterate over the number of globbed files */
 
     assert(*ppInst); /* Verify sanity */
 
@@ -193,11 +194,13 @@
     pppFiles = malloc(sizeof(struct dirent));
     nCount = scandir((*ppInst)->m_szLocs, pppFiles, analFileselect, alphasort);
 
-    /* Check out the health of this directory */
+    /* Check out the health of this directory listing */
     if (nCount == -1)
         return(RC_THROW(RC_ERR_DIR));
+    else /* Allocate for the string array to hold directory entry names */
+        (*ppInst)->m_szRcs = malloc(sizeof((*((*ppInst)->m_szRcs))) * (nCount + 1));
 
-    /* Loop through file index setting Rf file names according to dirent */
+    /* Loop through file index setting rc file names according to dirent */
     for (nIter = 0; nIter < nCount; ++nIter)
         (*ppInst)->m_szRcs[nIter] = strdup((*pppFiles)[nIter]->d_name);
     (*ppInst)->m_szRcs[nIter] = NULL;
@@ -239,6 +242,9 @@
 ************************************************/
 rc_return_t analDelete(rc_anal_t *pInst)
 {
+/* FIXME: It could be that pInst needs to be a double pointer to */
+/*        be properly used in destruction. Otherwise members are */
+/*        just copies of the stack parameters passed in.         */
     int nIter = 0;
 
     while (pInst->m_szRcs[nIter])   /* Rc file names       */

CVSTrac 2.0.1