replace 'strstr(xxx,"x_") == xxx' with utils::strmatch("^x_")
This commit is contained in:
@ -54,7 +54,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
xstr = ystr = zstr = nullptr;
|
||||
|
||||
if (strstr(arg[3],"v_") == arg[3]) {
|
||||
if (utils::strmatch(arg[3],"^v_")) {
|
||||
int n = strlen(&arg[3][2]) + 1;
|
||||
xstr = new char[n];
|
||||
strcpy(xstr,&arg[3][2]);
|
||||
@ -62,7 +62,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
xvalue = utils::numeric(FLERR,arg[3],false,lmp);
|
||||
xstyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[4],"v_") == arg[4]) {
|
||||
if (utils::strmatch(arg[4],"^v_")) {
|
||||
int n = strlen(&arg[4][2]) + 1;
|
||||
ystr = new char[n];
|
||||
strcpy(ystr,&arg[4][2]);
|
||||
@ -70,7 +70,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
yvalue = utils::numeric(FLERR,arg[4],false,lmp);
|
||||
ystyle = CONSTANT;
|
||||
}
|
||||
if (strstr(arg[5],"v_") == arg[5]) {
|
||||
if (utils::strmatch(arg[5],"^v_")) {
|
||||
int n = strlen(&arg[5][2]) + 1;
|
||||
zstr = new char[n];
|
||||
strcpy(zstr,&arg[5][2]);
|
||||
@ -102,7 +102,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"energy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix addforce command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) {
|
||||
int n = strlen(&arg[iarg+1][2]) + 1;
|
||||
estr = new char[n];
|
||||
strcpy(estr,&arg[iarg+1][2]);
|
||||
|
||||
Reference in New Issue
Block a user