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

@ -50,12 +50,12 @@ enum{NO,YES};
/* ---------------------------------------------------------------------- */
DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
DumpCustom(lmp, narg, arg), thetastr(NULL), phistr(NULL), cxstr(NULL),
cystr(NULL), czstr(NULL), upxstr(NULL), upystr(NULL), upzstr(NULL),
zoomstr(NULL), perspstr(NULL), diamtype(NULL), diamelement(NULL),
bdiamtype(NULL), colortype(NULL), colorelement(NULL), bcolortype(NULL),
avec_line(NULL), avec_tri(NULL), avec_body(NULL), fixptr(NULL), image(NULL),
chooseghost(NULL), bufcopy(NULL)
DumpCustom(lmp, narg, arg), thetastr(nullptr), phistr(nullptr), cxstr(nullptr),
cystr(nullptr), czstr(nullptr), upxstr(nullptr), upystr(nullptr), upzstr(nullptr),
zoomstr(nullptr), perspstr(nullptr), diamtype(nullptr), diamelement(nullptr),
bdiamtype(nullptr), colortype(nullptr), colorelement(nullptr), bcolortype(nullptr),
avec_line(nullptr), avec_tri(nullptr), avec_body(nullptr), fixptr(nullptr), image(nullptr),
chooseghost(nullptr), bufcopy(nullptr)
{
if (binary || multiproc) error->all(FLERR,"Invalid dump image filename");
@ -124,16 +124,16 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
bdiam = NUMERIC;
bdiamvalue = 0.5;
}
char *fixID = NULL;
char *fixID = nullptr;
thetastr = phistr = NULL;
thetastr = phistr = nullptr;
cflag = STATIC;
cx = cy = cz = 0.5;
cxstr = cystr = czstr = NULL;
cxstr = cystr = czstr = nullptr;
upxstr = upystr = upzstr = NULL;
zoomstr = NULL;
perspstr = NULL;
upxstr = upystr = upzstr = nullptr;
zoomstr = nullptr;
perspstr = nullptr;
boxflag = YES;
boxdiam = 0.02;
axesflag = NO;
@ -441,8 +441,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
else if (i % 6 == 0) bcolortype[i] = image->color2rgb("cyan");
}
} else {
bdiamtype = NULL;
bcolortype = NULL;
bdiamtype = nullptr;
bcolortype = nullptr;
}
// viewflag = DYNAMIC if any view parameter is dynamic
@ -458,8 +458,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
// local data
maxbufcopy = 0;
chooseghost = NULL;
bufcopy = NULL;
chooseghost = nullptr;
bufcopy = nullptr;
}
/* ---------------------------------------------------------------------- */
@ -566,7 +566,7 @@ void DumpImage::init_style()
if (atomflag && acolor == ELEMENT) {
for (int i = 1; i <= ntypes; i++) {
colorelement[i] = image->element2color(typenames[i]);
if (colorelement[i] == NULL)
if (colorelement[i] == nullptr)
error->all(FLERR,"Invalid dump image element name");
}
}
@ -606,7 +606,7 @@ void DumpImage::write()
// pack buf with color & diameter
pack(NULL);
pack(nullptr);
// set minmax color range if using dynamic atom color map
@ -641,7 +641,7 @@ void DumpImage::write()
else image->write_PPM(fp);
if (multifile) {
fclose(fp);
fp = NULL;
fp = nullptr;
}
}
}
@ -1261,7 +1261,7 @@ int DumpImage::modify_param(int narg, char **arg)
char **ptrs = new char*[ncount+1];
ncount = 0;
ptrs[ncount++] = strtok(arg[2],"/");
while ((ptrs[ncount++] = strtok(NULL,"/")));
while ((ptrs[ncount++] = strtok(nullptr,"/")));
ncount--;
// assign each of ncount colors in round-robin fashion to types
@ -1269,7 +1269,7 @@ int DumpImage::modify_param(int narg, char **arg)
int m = 0;
for (int i = nlo; i <= nhi; i++) {
colortype[i] = image->color2rgb(ptrs[m%ncount]);
if (colortype[i] == NULL)
if (colortype[i] == nullptr)
error->all(FLERR,"Invalid color in dump_modify command");
m++;
}
@ -1324,7 +1324,7 @@ int DumpImage::modify_param(int narg, char **arg)
char **ptrs = new char*[ncount+1];
ncount = 0;
ptrs[ncount++] = strtok(arg[2],"/");
while ((ptrs[ncount++] = strtok(NULL,"/")));
while ((ptrs[ncount++] = strtok(nullptr,"/")));
ncount--;
// assign each of ncount colors in round-robin fashion to types
@ -1332,7 +1332,7 @@ int DumpImage::modify_param(int narg, char **arg)
int m = 0;
for (int i = nlo; i <= nhi; i++) {
bcolortype[i] = image->color2rgb(ptrs[m%ncount]);
if (bcolortype[i] == NULL)
if (bcolortype[i] == nullptr)
error->all(FLERR,"Invalid color in dump_modify command");
m++;
}
@ -1356,7 +1356,7 @@ int DumpImage::modify_param(int narg, char **arg)
if (strcmp(arg[0],"backcolor") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
double *color = image->color2rgb(arg[1]);
if (color == NULL) error->all(FLERR,"Invalid color in dump_modify command");
if (color == nullptr) error->all(FLERR,"Invalid color in dump_modify command");
image->background[0] = static_cast<int> (color[0]*255.0);
image->background[1] = static_cast<int> (color[1]*255.0);
image->background[2] = static_cast<int> (color[2]*255.0);
@ -1366,7 +1366,7 @@ int DumpImage::modify_param(int narg, char **arg)
if (strcmp(arg[0],"boxcolor") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
image->boxcolor = image->color2rgb(arg[1]);
if (image->boxcolor == NULL)
if (image->boxcolor == nullptr)
error->all(FLERR,"Invalid color in dump_modify command");
return 2;
}