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:
Anne Gunn
2020-09-11 07:39:46 -06:00
parent 101d39142e
commit f1ef7d85a8
1217 changed files with 8531 additions and 8531 deletions

View File

@ -66,17 +66,17 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp)
first_flag = 0;
flush_flag = 1;
format = NULL;
format_default = NULL;
format = nullptr;
format_default = nullptr;
format_line_user = NULL;
format_float_user = NULL;
format_int_user = NULL;
format_bigint_user = NULL;
format_column_user = NULL;
format_line_user = nullptr;
format_float_user = nullptr;
format_int_user = nullptr;
format_bigint_user = nullptr;
format_column_user = nullptr;
refreshflag = 0;
refresh = NULL;
refresh = nullptr;
clearstep = 0;
sort_flag = 0;
@ -93,20 +93,20 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp)
maxfiles = -1;
numfiles = 0;
fileidx = 0;
nameslist = NULL;
nameslist = nullptr;
maxbuf = maxids = maxsort = maxproc = 0;
buf = bufsort = NULL;
ids = idsort = NULL;
index = proclist = NULL;
irregular = NULL;
buf = bufsort = nullptr;
ids = idsort = nullptr;
index = proclist = nullptr;
irregular = nullptr;
maxsbuf = 0;
sbuf = NULL;
sbuf = nullptr;
maxpbc = 0;
xpbc = vpbc = NULL;
imagepbc = NULL;
xpbc = vpbc = nullptr;
imagepbc = nullptr;
// parse filename for special syntax
// if contains '%', write one file per proc and replace % with proc-ID
@ -117,7 +117,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp)
// else if ends in .zst = Zstd compressed text file
// else ASCII text file
fp = NULL;
fp = nullptr;
singlefile_opened = 0;
compressed = 0;
binary = 0;
@ -128,7 +128,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp)
filewriter = 0;
if (me == 0) filewriter = 1;
fileproc = 0;
multiname = NULL;
multiname = nullptr;
char *ptr;
if ((ptr = strchr(filename,'%'))) {
@ -202,15 +202,15 @@ Dump::~Dump()
delete[] nameslist;
}
// XTC style sets fp to NULL since it closes file in its destructor
// XTC style sets fp to nullptr since it closes file in its destructor
if (multifile == 0 && fp != NULL) {
if (multifile == 0 && fp != nullptr) {
if (compressed) {
if (filewriter) pclose(fp);
} else {
if (filewriter) fclose(fp);
}
fp = NULL;
fp = nullptr;
}
}
@ -229,10 +229,10 @@ void Dump::init()
delete irregular;
maxids = maxsort = maxproc = 0;
bufsort = NULL;
ids = idsort = NULL;
index = proclist = NULL;
irregular = NULL;
bufsort = nullptr;
ids = idsort = nullptr;
index = proclist = nullptr;
irregular = nullptr;
}
if (sort_flag) {
@ -243,7 +243,7 @@ void Dump::init()
error->all(FLERR,"Cannot dump sort on atom IDs with no atom IDs defined");
if (sortcol && sortcol > size_one)
error->all(FLERR,"Dump sort column is invalid");
if (nprocs > 1 && irregular == NULL)
if (nprocs > 1 && irregular == nullptr)
irregular = new Irregular(lmp);
bigint size = group->count(igroup);
@ -438,7 +438,7 @@ void Dump::write()
// sort buf as needed
if (sort_flag && sortcol == 0) pack(ids);
else pack(NULL);
else pack(nullptr);
if (sort_flag) sort();
// if buffering, convert doubles into strings
@ -528,11 +528,11 @@ void Dump::write()
if (multifile) {
if (compressed) {
if (filewriter && fp != NULL) pclose(fp);
if (filewriter && fp != nullptr) pclose(fp);
} else {
if (filewriter && fp != NULL) fclose(fp);
if (filewriter && fp != nullptr) fclose(fp);
}
fp = NULL;
fp = nullptr;
}
}
@ -609,8 +609,8 @@ void Dump::openfile()
fp = fopen(filecurrent,"w");
}
if (fp == NULL) error->one(FLERR,"Cannot open dump file");
} else fp = NULL;
if (fp == nullptr) error->one(FLERR,"Cannot open dump file");
} else fp = nullptr;
// delete string with timestep replaced
@ -1013,10 +1013,10 @@ void Dump::modify_params(int narg, char **arg)
delete [] format_int_user;
delete [] format_bigint_user;
delete [] format_float_user;
format_line_user = NULL;
format_int_user = NULL;
format_bigint_user = NULL;
format_float_user = NULL;
format_line_user = nullptr;
format_int_user = nullptr;
format_bigint_user = nullptr;
format_float_user = nullptr;
// pass format none to child classes which may use it
// not an error if they don't
modify_param(narg-iarg,&arg[iarg]);
@ -1055,7 +1055,7 @@ void Dump::modify_params(int narg, char **arg)
nameslist = new char*[maxfiles];
numfiles = 0;
for (int idx=0; idx < maxfiles; ++idx)
nameslist[idx] = NULL;
nameslist[idx] = nullptr;
fileidx = 0;
}
iarg += 2;