T2345: Replace instances of NULL with nullptr
The following changes have been applied to src and lib folders: regex replace: ([^"_])NULL ⇒ \1nullptr (8968 chgs in src, 1153 in lib) Manually find/change: (void \*) nullptr ⇒ nullptr (1 case) regex find: ".*?nullptr.*?" Manually ~14 cases back to "NULL" in src, ~2 in lib regex finds a few false positive where nullptr appears between two strings in a function call
This commit is contained in:
@ -43,7 +43,7 @@ enum{DIAMETER,CHARGE};
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
|
||||
nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL)
|
||||
nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr)
|
||||
{
|
||||
if (narg < 5) error->all(FLERR,"Illegal fix adapt command");
|
||||
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
@ -96,7 +96,7 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL)
|
||||
strcpy(adapt[nadapt].pstyle,arg[iarg+1]);
|
||||
n = strlen(arg[iarg+2]) + 1;
|
||||
adapt[nadapt].pparam = new char[n];
|
||||
adapt[nadapt].pair = NULL;
|
||||
adapt[nadapt].pair = nullptr;
|
||||
strcpy(adapt[nadapt].pparam,arg[iarg+2]);
|
||||
utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes,
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
@ -118,7 +118,7 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL)
|
||||
strcpy(adapt[nadapt].bstyle,arg[iarg+1]);
|
||||
n = strlen(arg[iarg+2]) + 1;
|
||||
adapt[nadapt].bparam = new char[n];
|
||||
adapt[nadapt].bond = NULL;
|
||||
adapt[nadapt].bond = nullptr;
|
||||
strcpy(adapt[nadapt].bparam,arg[iarg+2]);
|
||||
utils::bounds(FLERR,arg[iarg+3],1,atom->nbondtypes,
|
||||
adapt[nadapt].ilo,adapt[nadapt].ihi,error);
|
||||
@ -263,8 +263,8 @@ void FixAdapt::post_constructor()
|
||||
// new id = fix-ID + FIX_STORE_ATTRIBUTE
|
||||
// new fix group = group for this fix
|
||||
|
||||
id_fix_diam = NULL;
|
||||
id_fix_chg = NULL;
|
||||
id_fix_diam = nullptr;
|
||||
id_fix_chg = nullptr;
|
||||
|
||||
if (diamflag && atom->radius_flag) {
|
||||
std::string fixcmd = id + std::string("_FIX_STORE_DIAM");
|
||||
@ -340,7 +340,7 @@ void FixAdapt::init()
|
||||
|
||||
if (ad->which == PAIR) {
|
||||
anypair = 1;
|
||||
ad->pair = NULL;
|
||||
ad->pair = nullptr;
|
||||
|
||||
// if ad->pstyle has trailing sub-style annotation ":N",
|
||||
// strip it for pstyle arg to pair_match() and set nsub = N
|
||||
@ -366,12 +366,12 @@ void FixAdapt::init()
|
||||
ad->pair = force->pair_match(psuffix,1,nsub);
|
||||
delete[] psuffix;
|
||||
}
|
||||
if (ad->pair == NULL) ad->pair = force->pair_match(pstyle,1,nsub);
|
||||
if (ad->pair == NULL)
|
||||
if (ad->pair == nullptr) ad->pair = force->pair_match(pstyle,1,nsub);
|
||||
if (ad->pair == nullptr)
|
||||
error->all(FLERR,"Fix adapt pair style does not exist");
|
||||
|
||||
void *ptr = ad->pair->extract(ad->pparam,ad->pdim);
|
||||
if (ptr == NULL)
|
||||
if (ptr == nullptr)
|
||||
error->all(FLERR,"Fix adapt pair style param not supported");
|
||||
|
||||
// for pair styles only parameters that are 2-d arrays in atom types or
|
||||
@ -396,7 +396,7 @@ void FixAdapt::init()
|
||||
|
||||
delete [] pstyle;
|
||||
} else if (ad->which == BOND){
|
||||
ad->bond = NULL;
|
||||
ad->bond = nullptr;
|
||||
anybond = 1;
|
||||
|
||||
int n = strlen(ad->bstyle) + 1;
|
||||
@ -412,13 +412,13 @@ void FixAdapt::init()
|
||||
ad->bond = force->bond_match(bsuffix);
|
||||
delete [] bsuffix;
|
||||
}
|
||||
if (ad->bond == NULL) ad->bond = force->bond_match(bstyle);
|
||||
if (ad->bond == NULL )
|
||||
if (ad->bond == nullptr) ad->bond = force->bond_match(bstyle);
|
||||
if (ad->bond == nullptr )
|
||||
error->all(FLERR,"Fix adapt bond style does not exist");
|
||||
|
||||
void *ptr = ad->bond->extract(ad->bparam,ad->bdim);
|
||||
|
||||
if (ptr == NULL)
|
||||
if (ptr == nullptr)
|
||||
error->all(FLERR,"Fix adapt bond style param not supported");
|
||||
|
||||
// for bond styles, use a vector
|
||||
@ -431,7 +431,7 @@ void FixAdapt::init()
|
||||
delete [] bstyle;
|
||||
|
||||
} else if (ad->which == KSPACE) {
|
||||
if (force->kspace == NULL)
|
||||
if (force->kspace == nullptr)
|
||||
error->all(FLERR,"Fix adapt kspace style does not exist");
|
||||
kspace_scale = (double *) force->kspace->extract("scale");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user