simplify using utils::strdup()
This commit is contained in:
@ -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");
|
||||
|
||||
Reference in New Issue
Block a user