simplify using utils::strdup()

This commit is contained in:
Axel Kohlmeyer
2021-03-18 20:56:04 -04:00
parent 1710fb86d3
commit a5563e8d04
18 changed files with 47 additions and 135 deletions

View File

@ -275,9 +275,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
else {
allremap = 0;
delete [] id_dilate;
int n = strlen(arg[iarg+1]) + 1;
id_dilate = new char[n];
strcpy(id_dilate,arg[iarg+1]);
id_dilate = utils::strdup(arg[iarg+1]);
int idilate = group->find(id_dilate);
if (idilate == -1)
error->all(FLERR,"Fix nvt/npt/nph dilate group ID does not exist");
@ -1414,9 +1412,7 @@ int FixNH::modify_param(int narg, char **arg)
tcomputeflag = 0;
}
delete [] id_temp;
int n = strlen(arg[1]) + 1;
id_temp = new char[n];
strcpy(id_temp,arg[1]);
id_temp = utils::strdup(arg[1]);
int icompute = modify->find_compute(arg[1]);
if (icompute < 0)
@ -1448,9 +1444,7 @@ int FixNH::modify_param(int narg, char **arg)
pcomputeflag = 0;
}
delete [] id_press;
int n = strlen(arg[1]) + 1;
id_press = new char[n];
strcpy(id_press,arg[1]);
id_press = utils::strdup(arg[1]);
int icompute = modify->find_compute(arg[1]);
if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID");