use vector<string> for type label arrays

This commit is contained in:
Jacob Gissinger
2020-12-17 14:21:42 -05:00
parent bc32dfb480
commit fef2d178e4
4 changed files with 28 additions and 63 deletions

View File

@ -1931,7 +1931,7 @@ void ReadData::impropercoeffs(int which)
/* ---------------------------------------------------------------------- */
void ReadData::typelabels(char **mytypelabel, int myntypes)
void ReadData::typelabels(std::vector<std::string> &mytypelabel, int myntypes)
{
int n;
char *next;
@ -1945,10 +1945,7 @@ void ReadData::typelabels(char **mytypelabel, int myntypes)
next = strchr(buf,'\n');
*next = '\0';
sscanf(buf,"%*d %s",typelabel);
n = strlen(typelabel) + 1;
delete [] mytypelabel[i];
mytypelabel[i] = new char[n];
strcpy(mytypelabel[i],typelabel);
mytypelabel[i] = typelabel;
buf = next + 1;
}
delete [] typelabel;