apply utils::strdup() in a few more cases
This commit is contained in:
@ -86,10 +86,8 @@ void KimInit::command(int narg, char **arg)
|
||||
if (domain->box_exist)
|
||||
error->all(FLERR,"Must use 'kim_init' command before "
|
||||
"simulation box is defined");
|
||||
char *model_name = new char[strlen(arg[0])+1];
|
||||
strcpy(model_name,arg[0]);
|
||||
char *user_units = new char[strlen(arg[1])+1];
|
||||
strcpy(user_units,arg[1]);
|
||||
char *model_name = utils::strdup(arg[0]);
|
||||
char *user_units = utils::strdup(arg[1]);
|
||||
if (narg == 3) {
|
||||
if (strcmp(arg[2],"unit_conversion_mode")==0) unit_conversion_mode = true;
|
||||
else {
|
||||
@ -214,8 +212,7 @@ void KimInit::determine_model_type_and_units(char * model_name,
|
||||
if (units_accepted) {
|
||||
logID = fmt::format("{}_Model", comm->me);
|
||||
KIM_Model_SetLogID(pkim, logID.c_str());
|
||||
*model_units = new char[strlen(user_units)+1];
|
||||
strcpy(*model_units,user_units);
|
||||
*model_units = utils::strdup(user_units);
|
||||
return;
|
||||
} else if (unit_conversion_mode) {
|
||||
KIM_Model_Destroy(&pkim);
|
||||
@ -237,8 +234,7 @@ void KimInit::determine_model_type_and_units(char * model_name,
|
||||
if (units_accepted) {
|
||||
logID = fmt::format("{}_Model", comm->me);
|
||||
KIM_Model_SetLogID(pkim, logID.c_str());
|
||||
*model_units = new char[strlen(systems[i])+1];
|
||||
strcpy(*model_units,systems[i]);
|
||||
*model_units = utils::strdup(systems[i]);
|
||||
return;
|
||||
}
|
||||
KIM_Model_Destroy(&pkim);
|
||||
@ -272,9 +268,7 @@ void KimInit::determine_model_type_and_units(char * model_name,
|
||||
if (0 == strcmp(sim_field,"units")) {
|
||||
KIM_SimulatorModel_GetSimulatorFieldLine(
|
||||
simulatorModel, i, 0, &sim_value);
|
||||
int len=strlen(sim_value)+1;
|
||||
*model_units = new char[len];
|
||||
strcpy(*model_units,sim_value);
|
||||
*model_units = utils::strdup(sim_value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,9 +53,7 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
int iarg = 5;
|
||||
if ((narg > 6) && (strcmp(arg[5],"group") == 0)) {
|
||||
int len = strlen(arg[6])+1;
|
||||
group2 = new char[len];
|
||||
strcpy(group2,arg[6]);
|
||||
group2 = utils::strdup(arg[6]);
|
||||
iarg += 2;
|
||||
jgroup = group->find(group2);
|
||||
if (jgroup == -1)
|
||||
|
||||
@ -13,13 +13,12 @@
|
||||
|
||||
#include "fix_property_atom.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -126,9 +125,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// store current atom style
|
||||
|
||||
int n = strlen(atom->atom_style) + 1;
|
||||
astyle = new char[n];
|
||||
strcpy(astyle,atom->atom_style);
|
||||
astyle = utils::strdup(atom->atom_style);
|
||||
|
||||
// perform initial allocation of atom-based array
|
||||
// register with Atom class
|
||||
|
||||
@ -49,9 +49,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[3][2]);
|
||||
xstr = utils::strdup(arg[3]+2);
|
||||
} else if (strcmp(arg[3],"NULL") == 0) {
|
||||
xstyle = NONE;
|
||||
} else {
|
||||
@ -59,9 +57,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
xstyle = CONSTANT;
|
||||
}
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[4][2]);
|
||||
ystr = utils::strdup(arg[4]+2);
|
||||
} else if (strcmp(arg[4],"NULL") == 0) {
|
||||
ystyle = NONE;
|
||||
} else {
|
||||
@ -69,9 +65,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
ystyle = CONSTANT;
|
||||
}
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[5][2]);
|
||||
zstr = utils::strdup(arg[5]+2);
|
||||
} else if (strcmp(arg[5],"NULL") == 0) {
|
||||
zstyle = NONE;
|
||||
} else {
|
||||
@ -91,9 +85,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
iregion = domain->find_region(arg[iarg+1]);
|
||||
if (iregion == -1)
|
||||
error->all(FLERR,"Region ID for fix setforce does not exist");
|
||||
int n = strlen(arg[iarg+1]) + 1;
|
||||
idregion = new char[n];
|
||||
strcpy(idregion,arg[iarg+1]);
|
||||
idregion = utils::strdup(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix setforce command");
|
||||
}
|
||||
|
||||
@ -12,20 +12,20 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_temp_berendsen.h"
|
||||
#include <cstring>
|
||||
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "comm.h"
|
||||
#include "input.h"
|
||||
#include "variable.h"
|
||||
#include "group.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
#include "compute.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "input.h"
|
||||
#include "modify.h"
|
||||
#include "update.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -52,9 +52,7 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
tstr = nullptr;
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[3][2]);
|
||||
tstr = utils::strdup(arg[3]+2);
|
||||
tstyle = EQUAL;
|
||||
} else {
|
||||
t_start = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
@ -74,9 +72,7 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) :
|
||||
// id = fix-ID + temp, compute group = fix group
|
||||
|
||||
std::string cmd = id + std::string("_temp");
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
id_temp = utils::strdup(cmd);
|
||||
cmd += fmt::format(" {} temp",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
tflag = 1;
|
||||
|
||||
@ -16,22 +16,22 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_temp_csld.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "compute.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "input.h"
|
||||
#include "memory.h"
|
||||
#include "modify.h"
|
||||
#include "random_mars.h"
|
||||
#include "update.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "comm.h"
|
||||
#include "input.h"
|
||||
#include "variable.h"
|
||||
#include "group.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
#include "compute.h"
|
||||
#include "random_mars.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -58,9 +58,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
tstr = nullptr;
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[3][2]);
|
||||
tstr = utils::strdup(arg[3]+2);
|
||||
tstyle = EQUAL;
|
||||
} else {
|
||||
t_start = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
@ -83,9 +81,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) :
|
||||
// id = fix-ID + temp, compute group = fix group
|
||||
|
||||
std::string cmd = id + std::string("_temp");
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
id_temp = utils::strdup(cmd);
|
||||
cmd += fmt::format(" {} temp",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
tflag = 1;
|
||||
|
||||
@ -18,22 +18,21 @@
|
||||
|
||||
#include "fix_temp_csvr.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "compute.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "input.h"
|
||||
#include "modify.h"
|
||||
#include "random_mars.h"
|
||||
#include "update.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "comm.h"
|
||||
#include "input.h"
|
||||
#include "variable.h"
|
||||
#include "group.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
#include "compute.h"
|
||||
#include "random_mars.h"
|
||||
#include "error.h"
|
||||
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
||||
@ -135,9 +134,7 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
tstr = nullptr;
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[3][2]);
|
||||
tstr = utils::strdup(arg[3]+2);
|
||||
tstyle = EQUAL;
|
||||
} else {
|
||||
t_start = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
@ -160,9 +157,7 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
|
||||
// id = fix-ID + temp, compute group = fix group
|
||||
|
||||
std::string cmd = id + std::string("_temp");
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
id_temp = utils::strdup(cmd);
|
||||
cmd += fmt::format(" {} temp",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
tflag = 1;
|
||||
|
||||
@ -12,20 +12,20 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_temp_rescale.h"
|
||||
#include <cstring>
|
||||
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "update.h"
|
||||
#include "comm.h"
|
||||
#include "input.h"
|
||||
#include "variable.h"
|
||||
#include "modify.h"
|
||||
#include "compute.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "input.h"
|
||||
#include "modify.h"
|
||||
#include "update.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -52,9 +52,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
tstr = nullptr;
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
tstr = new char[n];
|
||||
strcpy(tstr,&arg[4][2]);
|
||||
tstr = utils::strdup(arg[4]+2);
|
||||
tstyle = EQUAL;
|
||||
} else {
|
||||
t_start = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
@ -70,9 +68,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) :
|
||||
// id = fix-ID + temp, compute group = fix group
|
||||
|
||||
std::string cmd = id + std::string("_temp");
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
id_temp = utils::strdup(cmd);
|
||||
cmd += fmt::format(" {} temp",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
tflag = 1;
|
||||
|
||||
@ -81,18 +81,14 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
|
||||
else coord0[nwall] = domain->boxhi[dim];
|
||||
} else if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
xstyle[nwall] = VARIABLE;
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
xstr[nwall] = new char[n];
|
||||
strcpy(xstr[nwall],&arg[iarg+1][2]);
|
||||
xstr[nwall] = utils::strdup(arg[iarg+1]+2);
|
||||
} else {
|
||||
xstyle[nwall] = CONSTANT;
|
||||
coord0[nwall] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
}
|
||||
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) {
|
||||
int n = strlen(&arg[iarg+2][2]) + 1;
|
||||
estr[nwall] = new char[n];
|
||||
strcpy(estr[nwall],&arg[iarg+2][2]);
|
||||
estr[nwall] = utils::strdup(arg[iarg+2]+2);
|
||||
estyle[nwall] = VARIABLE;
|
||||
} else {
|
||||
epsilon[nwall] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
@ -101,9 +97,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
if (utils::strmatch(style,"^wall/morse")) {
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
astr[nwall] = new char[n];
|
||||
strcpy(astr[nwall],&arg[iarg+3][2]);
|
||||
astr[nwall] = utils::strdup(arg[iarg+3]+2);
|
||||
astyle[nwall] = VARIABLE;
|
||||
} else {
|
||||
alpha[nwall] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
@ -113,9 +107,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) {
|
||||
int n = strlen(&arg[iarg+3][2]) + 1;
|
||||
sstr[nwall] = new char[n];
|
||||
strcpy(sstr[nwall],&arg[iarg+3][2]);
|
||||
sstr[nwall] = utils::strdup(arg[iarg+3]+2);
|
||||
sstyle[nwall] = VARIABLE;
|
||||
} else {
|
||||
sigma[nwall] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
|
||||
@ -75,9 +75,7 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
|
||||
else coord0[nwall] = domain->boxhi[dim];
|
||||
} else if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
wallstyle[nwall] = VARIABLE;
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
varstr[nwall] = new char[n];
|
||||
strcpy(varstr[nwall],&arg[iarg+1][2]);
|
||||
varstr[nwall] = utils::strdup(arg[iarg+1]+2);
|
||||
} else {
|
||||
wallstyle[nwall] = CONSTANT;
|
||||
coord0[nwall] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
|
||||
@ -665,9 +665,7 @@ void Output::set_thermo(int narg, char **arg)
|
||||
var_thermo = nullptr;
|
||||
|
||||
if (utils::strmatch(arg[0],"^v_")) {
|
||||
int n = strlen(&arg[0][2]) + 1;
|
||||
var_thermo = new char[n];
|
||||
strcpy(var_thermo,&arg[0][2]);
|
||||
var_thermo = utils::strdup(arg[0]+2);
|
||||
} else {
|
||||
thermo_every = utils::inumeric(FLERR,arg[0],false,lmp);
|
||||
if (thermo_every < 0) error->all(FLERR,"Illegal thermo command");
|
||||
@ -745,9 +743,7 @@ void Output::create_restart(int narg, char **arg)
|
||||
|
||||
if (varflag) {
|
||||
delete [] var_restart_single;
|
||||
int n = strlen(&arg[0][2]) + 1;
|
||||
var_restart_single = new char[n];
|
||||
strcpy(var_restart_single,&arg[0][2]);
|
||||
var_restart_single = utils::strdup(arg[0]+2);
|
||||
restart_every_single = 0;
|
||||
} else restart_every_single = every;
|
||||
|
||||
@ -763,9 +759,7 @@ void Output::create_restart(int narg, char **arg)
|
||||
|
||||
if (varflag) {
|
||||
delete [] var_restart_double;
|
||||
int n = strlen(&arg[0][2]) + 1;
|
||||
var_restart_double = new char[n];
|
||||
strcpy(var_restart_double,&arg[0][2]);
|
||||
var_restart_double = utils::strdup(arg[0]+2);
|
||||
restart_every_double = 0;
|
||||
} else restart_every_double = every;
|
||||
|
||||
|
||||
@ -45,9 +45,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
if (axis == 'x') {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(arg[3]+2) + 1;
|
||||
c1str = new char[n];
|
||||
strcpy(c1str,arg[3]+2);
|
||||
c1str = utils::strdup(arg[3]+2);
|
||||
c1 = 0.0;
|
||||
c1style = VARIABLE;
|
||||
varshape = 1;
|
||||
@ -56,9 +54,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
c1style = CONSTANT;
|
||||
}
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(arg[4]+2) + 1;
|
||||
c2str = new char[n];
|
||||
strcpy(c2str,arg[4]+2);
|
||||
c2str = utils::strdup(arg[4]+2);
|
||||
c2 = 0.0;
|
||||
c2style = VARIABLE;
|
||||
varshape = 1;
|
||||
@ -68,9 +64,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
} else if (axis == 'y') {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(arg[3]+2) + 1;
|
||||
c1str = new char[n];
|
||||
strcpy(c1str,arg[3]+2);
|
||||
c1str = utils::strdup(arg[3]+2);
|
||||
c1 = 0.0;
|
||||
c1style = VARIABLE;
|
||||
varshape = 1;
|
||||
@ -79,9 +73,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
c1style = CONSTANT;
|
||||
}
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(arg[4]+2) + 1;
|
||||
c2str = new char[n];
|
||||
strcpy(c2str,arg[4]+2);
|
||||
c2str = utils::strdup(arg[4]+2);
|
||||
c2 = 0.0;
|
||||
c2style = VARIABLE;
|
||||
varshape = 1;
|
||||
@ -91,9 +83,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
} else if (axis == 'z') {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(arg[3]+2) + 1;
|
||||
c1str = new char[n];
|
||||
strcpy(c1str,arg[3]+2);
|
||||
c1str = utils::strdup(arg[3]+2);
|
||||
c1 = 0.0;
|
||||
c1style = VARIABLE;
|
||||
varshape = 1;
|
||||
@ -102,9 +92,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
c1style = CONSTANT;
|
||||
}
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(arg[4]+2) + 1;
|
||||
c2str = new char[n];
|
||||
strcpy(c2str,arg[4]+2);
|
||||
c2str = utils::strdup(arg[4]+2);
|
||||
c2 = 0.0;
|
||||
c2style = VARIABLE;
|
||||
varshape = 1;
|
||||
@ -115,9 +103,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
rstr = new char[n];
|
||||
strcpy(rstr,&arg[5][2]);
|
||||
rstr = utils::strdup(arg[5]+2);
|
||||
radius = 0.0;
|
||||
rstyle = VARIABLE;
|
||||
varshape = 1;
|
||||
|
||||
@ -33,9 +33,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
options(narg-6,&arg[6]);
|
||||
|
||||
if (utils::strmatch(arg[2],"^v_")) {
|
||||
int n = strlen(arg[2]+2) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,arg[2]+2);
|
||||
xstr = utils::strdup(arg[2]+2);
|
||||
xc = 0.0;
|
||||
xstyle = VARIABLE;
|
||||
varshape = 1;
|
||||
@ -45,9 +43,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(arg[3]+2) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,arg[3]+2);
|
||||
ystr = utils::strdup(arg[3]+2);
|
||||
yc = 0.0;
|
||||
ystyle = VARIABLE;
|
||||
varshape = 1;
|
||||
@ -57,9 +53,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(arg[4]+2) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,arg[4]+2);
|
||||
zstr = utils::strdup(arg[4]+2);
|
||||
zc = 0.0;
|
||||
zstyle = VARIABLE;
|
||||
varshape = 1;
|
||||
@ -69,9 +63,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
rstr = new char[n];
|
||||
strcpy(rstr,&arg[5][2]);
|
||||
rstr = utils::strdup(arg[5]+2);
|
||||
radius = 0.0;
|
||||
rstyle = VARIABLE;
|
||||
varshape = 1;
|
||||
|
||||
@ -71,9 +71,7 @@ void Set::command(int narg, char **arg)
|
||||
else if (strcmp(arg[0],"region") == 0) style = REGION_SELECT;
|
||||
else error->all(FLERR,"Illegal set command");
|
||||
|
||||
int n = strlen(arg[1]) + 1;
|
||||
id = new char[n];
|
||||
strcpy(id,arg[1]);
|
||||
id = utils::strdup(arg[1]);
|
||||
select = nullptr;
|
||||
selection(atom->nlocal);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user