--- rc_sect.c 2003/06/13 11:50:37 1.13
+++ rc_sect.c 2003/06/18 14:35:29 1.14
@@ -69,7 +69,6 @@
pSec = (rc_section_t *)malloc(sizeof(rc_section_t));
pSec->m_nPri = pOrigsec->m_nPri;
pSec->m_nUid = pOrigsec->m_nUid;
- pSec->m_Bytes = pOrigsec->m_Bytes;
/* Deep copy of user name */
if (pOrigsec->m_szLogin) {
@@ -145,16 +144,6 @@
return(0); /* Not reached */
}
-size_t sectionGetlen(rc_section_t *pSec)
-{ /* Data length of section, length of a script body of a particular section */
- if (pSec)
- return(pSec->m_Bytes);
- else
- RC_THROW(RC_ERR_USE);
-
- return(0); /* Not reached */
-}
-
/************************************************
* sectionSetXXX(rc_section_t *) *
* Accessor methods *
@@ -204,14 +193,14 @@
rc_return_t sectionSetdata(rc_section_t *pSec, const char *kszScript)
{ /* Data of section, this is the script body of the particular section */
if (pSec) {
- pSec->m_Bytes = (strlen(kszScript) + sizeof(char)) * sizeof(char);
+ size_t nBytes = (strlen(kszScript) + sizeof(char)) * sizeof(char);
if (pSec->m_szData) { /* The section data is already in use */
free(pSec->m_szData);
- pSec->m_szData = malloc(pSec->m_Bytes);
+ pSec->m_szData = malloc(nBytes);
strcpy(pSec->m_szData, kszScript);
}
else { /* Set the data the usual way */
- pSec->m_szData = malloc(pSec->m_Bytes);
+ pSec->m_szData = malloc(nBytes);
strcpy(pSec->m_szData, kszScript);
}
return(RC_THROW(RC_OK));
@@ -223,15 +212,15 @@
rc_return_t sectionSetndata(rc_section_t *pSec, const char *kszScript, size_t Len)
{ /* Data of section, this is the script body of the particular section */
if (pSec) {
- pSec->m_Bytes = (Len + 1) * sizeof(char); /* Set size */
+ size_t nBytes = (Len + 1) * sizeof(char); /* Set size */
if (pSec->m_szData) { /* The section data is already in use */
free(pSec->m_szData);
- pSec->m_szData = malloc(pSec->m_Bytes);
+ pSec->m_szData = malloc(nBytes);
strncpy(pSec->m_szData, kszScript, Len);
*(pSec->m_szData + Len) = '\0'; /* Terminate outgoing */
}
else { /* Set the data the usual way */
- pSec->m_szData = malloc(pSec->m_Bytes);
+ pSec->m_szData = malloc(nBytes);
strncpy(pSec->m_szData, kszScript, Len);
*(pSec->m_szData + Len) = '\0'; /* Terminate outgoing */
}
|