Check-in Number:
|
3399 | |
Date: |
2003-May-28 17:09:29 (local)
2003-May-28 15:09:29 (UTC) |
User: | ms |
Branch: | |
Comment: |
Fix incorrect variable name m_szRcs, bug fix analyzer rc list algorythm. |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/rc/rc_anal.c 1.17 -> 1.18
--- rc_anal.c 2003/05/28 13:12:31 1.17
+++ rc_anal.c 2003/05/28 15:09:29 1.18
@@ -57,15 +57,17 @@
{
ex_t Except;
- assert(!(*ppInst)->m_szRcs); /* Rcs should be NULL until we set them */
+ assert(!(*ppInst)->m_pszRcs); /* Rcs should be NULL until we set them */
if (!kszName)
return(RC_THROW(RC_ERR_RCF));
else { /* Only enter block with valid string, strdup can't handle NULL */
- (*ppInst)->m_szRcs = malloc(sizeof(char **));
+ (*ppInst)->m_pszRcs = malloc(sizeof(char **));
if (strcmp(kszName, RC_GLOB_WILD)) {
- (*ppInst)->m_szRcs = malloc(sizeof(*((*ppInst)->m_szRcs)));
- *(*ppInst)->m_szRcs = strdup(kszName);
+ (*ppInst)->m_pszRcs = malloc(sizeof(*((*ppInst)->m_pszRcs)) * 2);
+ (*ppInst)->m_pszRcs[0] = strdup(kszName);
+ (*ppInst)->m_pszRcs[0] = strdup(kszName);
+ (*ppInst)->m_pszRcs[1] = NULL;
(*ppInst)->m_nRcs = 1; /* We handle just one rc file */
}
else { /* Wildcard rcfile indicates we must glob the locs directories */
@@ -199,21 +201,21 @@
if (nCount == 0) /* Check out the health of this directory listing */
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));
+ (*ppInst)->m_pszRcs = malloc(sizeof(*((*ppInst)->m_pszRcs)) * (nCount + 1));
/* Loop through file index setting rc file names according to dirent */
if ((pLocdir = opendir((*ppInst)->m_szLocs)) == NULL)
return(RC_THROW(RC_ERR_DIR));
for (pDirent = readdir(pLocdir); pDirent; pDirent = readdir(pLocdir)) {
if (!strncmp(pDirent->d_name, "rc.", 3)) {
- (*ppInst)->m_szRcs[nIter] = strdup(pDirent->d_name + \
- strlen("rc.") * sizeof(char));
+ (*ppInst)->m_pszRcs[nIter] = strdup(pDirent->d_name + \
+ strlen("rc.") * sizeof(char));
nIter++;
}
}
closedir(pLocdir);
- (*ppInst)->m_szRcs[nIter] = NULL; /* Terminate */
+ (*ppInst)->m_pszRcs[nIter] = NULL; /* Terminate */
(*ppInst)->m_nRcs = nCount; /* Store how many globbed files there are */
return(RC_THROW(RC_OK));
@@ -254,11 +256,11 @@
assert(pInst); /* Verify sanity */
- if (pInst->m_szRcs && pInst->m_szRcs[nIter])
- while (pInst->m_szRcs[nIter]) /* Rc file names */
- free(pInst->m_szRcs[nIter++]);
- if (pInst->m_szRcs) /* Rc file name index */
- free(pInst->m_szRcs);
+ if (pInst->m_pszRcs && pInst->m_pszRcs[nIter])
+ while (pInst->m_pszRcs[nIter]) /* Rc file names */
+ free(pInst->m_pszRcs[nIter++]);
+ if (pInst->m_pszRcs) /* Rc file name index */
+ free(pInst->m_pszRcs);
if (pInst->m_szTmp) /* Temp file name */
free(pInst->m_szTmp);
if (pInst->m_szFuncs) /* Function file names */
|
|
ossp-pkg/rc/rc_private.h 1.28 -> 1.29
--- rc_private.h 2003/05/21 12:49:21 1.28
+++ rc_private.h 2003/05/28 15:09:29 1.29
@@ -77,7 +77,7 @@
typedef struct {
short m_nRcs; /* How many rc files */
short m_nSecs; /* How many sections */
- char **m_szRcs; /* Rc file names */
+ char **m_pszRcs; /* Rc file names */
char *m_szTmp; /* Temp file name */
char *m_szFuncs; /* Function file names */
char *m_szLocs; /* Location path names */
|
|
ossp-pkg/rc/rc_proc.c 1.39 -> 1.40
--- rc_proc.c 2003/05/28 14:40:25 1.39
+++ rc_proc.c 2003/05/28 15:09:29 1.40
@@ -85,7 +85,7 @@
char *szLocex = NULL;
rc_script_t *pTempscript = NULL;
- assert(*pRc->m_pAnal->m_szRcs);
+ assert(*pRc->m_pAnal->m_pszRcs);
sBuf = (char *)calloc(1, RC_READ_BUFSIZE);
/* Stick on the starting shell id line */
@@ -109,19 +109,19 @@
/* Iteratively read possibly globbed rc files */
for (nRc = 0; nRc < pRc->m_pAnal->m_nRcs; nRc++)
{
- assert(*pRc->m_pAnal->m_szRcs); /* If one of these assertions fail, */
- assert(pRc->m_pAnal->m_szLocs); /* you've probably seen the ex_ bug */
+ assert(*pRc->m_pAnal->m_pszRcs);
+ assert(pRc->m_pAnal->m_szLocs);
/* Construct a new label */
- pRc->m_ppLabvec[nRc] = labelNew(pRc->m_pAnal->m_szRcs[nRc]);
+ pRc->m_ppLabvec[nRc] = labelNew(pRc->m_pAnal->m_pszRcs[nRc]);
/* Build the path name */
szLocex = (char *)malloc(strlen(pRc->m_pAnal->m_szLocs) + \
- strlen(pRc->m_pAnal->m_szRcs[nRc]) + \
+ strlen(pRc->m_pAnal->m_pszRcs[nRc]) + \
strlen("rc.") + 1);
strcpy(szLocex, pRc->m_pAnal->m_szLocs);
strcat(szLocex, "rc."); /* FIXME: Make the prefix configurable */
- strcat(szLocex, pRc->m_pAnal->m_szRcs[nRc]);
+ strcat(szLocex, pRc->m_pAnal->m_pszRcs[nRc]);
/* Open the rc file unconditionally */
if ((nFdrc = open(szLocex, O_RDONLY)) == -1)
@@ -154,7 +154,7 @@
else if (configGetval(RC_DBG_VAL)) /* Only show if debug set */
fprintf(stderr, "#Warning: Missing section '%s' in %s!\n",\
pRc->m_pAnal->m_pszSecs[nSect],\
- pRc->m_pAnal->m_szRcs[nRc]);
+ pRc->m_pAnal->m_pszRcs[nRc]);
if (pSec) { /* Cleanup iterative section string */
sectionDelete(pSec);
|
|