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:
@ -62,7 +62,7 @@ enum{NONE,APPEND,VALUE,MERGE};
|
||||
const char *suffixes[] = {"/cuda","/gpu","/opt","/omp","/kk",
|
||||
"/coul/cut","/coul/long","/coul/msm",
|
||||
"/coul/dsf","/coul/debye","/coul/charmm",
|
||||
NULL};
|
||||
nullptr};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -74,8 +74,8 @@ ReadData::ReadData(LAMMPS *lmp) : Pointers(lmp)
|
||||
style = new char[MAXLINE];
|
||||
buffer = new char[CHUNK*MAXLINE];
|
||||
narg = maxarg = 0;
|
||||
arg = NULL;
|
||||
fp = NULL;
|
||||
arg = nullptr;
|
||||
fp = nullptr;
|
||||
|
||||
// customize for new sections
|
||||
// pointers to atom styles that store bonus info
|
||||
@ -132,9 +132,9 @@ void ReadData::command(int narg, char **arg)
|
||||
groupbit = 0;
|
||||
|
||||
nfix = 0;
|
||||
fix_index = NULL;
|
||||
fix_header = NULL;
|
||||
fix_section = NULL;
|
||||
fix_index = nullptr;
|
||||
fix_header = nullptr;
|
||||
fix_section = nullptr;
|
||||
|
||||
int iarg = 1;
|
||||
while (iarg < narg) {
|
||||
@ -277,7 +277,7 @@ void ReadData::command(int narg, char **arg)
|
||||
fix_index[nfix] = modify->find_fix(arg[iarg+1]);
|
||||
if (fix_index[nfix] < 0)
|
||||
error->all(FLERR,"Fix ID for read_data does not exist");
|
||||
if (strcmp(arg[iarg+2],"NULL") == 0) fix_header[nfix] = NULL;
|
||||
if (strcmp(arg[iarg+2],"NULL") == 0) fix_header[nfix] = nullptr;
|
||||
else {
|
||||
int n = strlen(arg[iarg+2]) + 1;
|
||||
fix_header[nfix] = new char[n];
|
||||
@ -334,12 +334,12 @@ void ReadData::command(int narg, char **arg)
|
||||
|
||||
// set up pointer to hold original styles while we replace them with "zero"
|
||||
|
||||
Pair *saved_pair = NULL;
|
||||
Bond *saved_bond = NULL;
|
||||
Angle *saved_angle = NULL;
|
||||
Dihedral *saved_dihedral = NULL;
|
||||
Improper *saved_improper = NULL;
|
||||
KSpace *saved_kspace = NULL;
|
||||
Pair *saved_pair = nullptr;
|
||||
Bond *saved_bond = nullptr;
|
||||
Angle *saved_angle = nullptr;
|
||||
Dihedral *saved_dihedral = nullptr;
|
||||
Improper *saved_improper = nullptr;
|
||||
KSpace *saved_kspace = nullptr;
|
||||
|
||||
if (coeffflag == 0) {
|
||||
char *coeffs[2];
|
||||
@ -347,33 +347,33 @@ void ReadData::command(int narg, char **arg)
|
||||
coeffs[1] = (char *) "nocoeff";
|
||||
|
||||
saved_pair = force->pair;
|
||||
force->pair = NULL;
|
||||
force->pair = nullptr;
|
||||
force->create_pair("zero",0);
|
||||
if (force->pair) force->pair->settings(2,coeffs);
|
||||
|
||||
coeffs[0] = coeffs[1];
|
||||
saved_bond = force->bond;
|
||||
force->bond = NULL;
|
||||
force->bond = nullptr;
|
||||
force->create_bond("zero",0);
|
||||
if (force->bond) force->bond->settings(1,coeffs);
|
||||
|
||||
saved_angle = force->angle;
|
||||
force->angle = NULL;
|
||||
force->angle = nullptr;
|
||||
force->create_angle("zero",0);
|
||||
if (force->angle) force->angle->settings(1,coeffs);
|
||||
|
||||
saved_dihedral = force->dihedral;
|
||||
force->dihedral = NULL;
|
||||
force->dihedral = nullptr;
|
||||
force->create_dihedral("zero",0);
|
||||
if (force->dihedral) force->dihedral->settings(1,coeffs);
|
||||
|
||||
saved_improper = force->improper;
|
||||
force->improper = NULL;
|
||||
force->improper = nullptr;
|
||||
force->create_improper("zero",0);
|
||||
if (force->improper) force->improper->settings(1,coeffs);
|
||||
|
||||
saved_kspace = force->kspace;
|
||||
force->kspace = NULL;
|
||||
force->kspace = nullptr;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
@ -414,7 +414,7 @@ void ReadData::command(int narg, char **arg)
|
||||
if (me == 0) {
|
||||
if (firstpass) utils::logmesg(lmp,"Reading data file ...\n");
|
||||
open(arg[0]);
|
||||
} else fp = NULL;
|
||||
} else fp = nullptr;
|
||||
|
||||
// read header info
|
||||
|
||||
@ -578,7 +578,7 @@ void ReadData::command(int narg, char **arg)
|
||||
if (firstpass) mass();
|
||||
else skip_lines(ntypes);
|
||||
} else if (strcmp(keyword,"Pair Coeffs") == 0) {
|
||||
if (force->pair == NULL)
|
||||
if (force->pair == nullptr)
|
||||
error->all(FLERR,"Must define pair_style before Pair Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style,force->pair_style))
|
||||
@ -587,7 +587,7 @@ void ReadData::command(int narg, char **arg)
|
||||
paircoeffs();
|
||||
} else skip_lines(ntypes);
|
||||
} else if (strcmp(keyword,"PairIJ Coeffs") == 0) {
|
||||
if (force->pair == NULL)
|
||||
if (force->pair == nullptr)
|
||||
error->all(FLERR,"Must define pair_style before PairIJ Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style,force->pair_style))
|
||||
@ -598,7 +598,7 @@ void ReadData::command(int narg, char **arg)
|
||||
} else if (strcmp(keyword,"Bond Coeffs") == 0) {
|
||||
if (atom->avec->bonds_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: Bond Coeffs");
|
||||
if (force->bond == NULL)
|
||||
if (force->bond == nullptr)
|
||||
error->all(FLERR,"Must define bond_style before Bond Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style,force->bond_style))
|
||||
@ -609,7 +609,7 @@ void ReadData::command(int narg, char **arg)
|
||||
} else if (strcmp(keyword,"Angle Coeffs") == 0) {
|
||||
if (atom->avec->angles_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: Angle Coeffs");
|
||||
if (force->angle == NULL)
|
||||
if (force->angle == nullptr)
|
||||
error->all(FLERR,"Must define angle_style before Angle Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style,force->angle_style))
|
||||
@ -620,7 +620,7 @@ void ReadData::command(int narg, char **arg)
|
||||
} else if (strcmp(keyword,"Dihedral Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: Dihedral Coeffs");
|
||||
if (force->dihedral == NULL)
|
||||
if (force->dihedral == nullptr)
|
||||
error->all(FLERR,"Must define dihedral_style before Dihedral Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style,force->dihedral_style))
|
||||
@ -631,7 +631,7 @@ void ReadData::command(int narg, char **arg)
|
||||
} else if (strcmp(keyword,"Improper Coeffs") == 0) {
|
||||
if (atom->avec->impropers_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: Improper Coeffs");
|
||||
if (force->improper == NULL)
|
||||
if (force->improper == nullptr)
|
||||
error->all(FLERR,"Must define improper_style before Improper Coeffs");
|
||||
if (firstpass) {
|
||||
if (me == 0 && !style_match(style,force->improper_style))
|
||||
@ -643,14 +643,14 @@ void ReadData::command(int narg, char **arg)
|
||||
} else if (strcmp(keyword,"BondBond Coeffs") == 0) {
|
||||
if (atom->avec->angles_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: BondBond Coeffs");
|
||||
if (force->angle == NULL)
|
||||
if (force->angle == nullptr)
|
||||
error->all(FLERR,"Must define angle_style before BondBond Coeffs");
|
||||
if (firstpass) anglecoeffs(1);
|
||||
else skip_lines(nangletypes);
|
||||
} else if (strcmp(keyword,"BondAngle Coeffs") == 0) {
|
||||
if (atom->avec->angles_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: BondAngle Coeffs");
|
||||
if (force->angle == NULL)
|
||||
if (force->angle == nullptr)
|
||||
error->all(FLERR,"Must define angle_style before BondAngle Coeffs");
|
||||
if (firstpass) anglecoeffs(2);
|
||||
else skip_lines(nangletypes);
|
||||
@ -659,7 +659,7 @@ void ReadData::command(int narg, char **arg)
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,
|
||||
"Invalid data file section: MiddleBondTorsion Coeffs");
|
||||
if (force->dihedral == NULL)
|
||||
if (force->dihedral == nullptr)
|
||||
error->all(FLERR,
|
||||
"Must define dihedral_style before "
|
||||
"MiddleBondTorsion Coeffs");
|
||||
@ -668,7 +668,7 @@ void ReadData::command(int narg, char **arg)
|
||||
} else if (strcmp(keyword,"EndBondTorsion Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: EndBondTorsion Coeffs");
|
||||
if (force->dihedral == NULL)
|
||||
if (force->dihedral == nullptr)
|
||||
error->all(FLERR,
|
||||
"Must define dihedral_style before EndBondTorsion Coeffs");
|
||||
if (firstpass) dihedralcoeffs(2);
|
||||
@ -676,7 +676,7 @@ void ReadData::command(int narg, char **arg)
|
||||
} else if (strcmp(keyword,"AngleTorsion Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: AngleTorsion Coeffs");
|
||||
if (force->dihedral == NULL)
|
||||
if (force->dihedral == nullptr)
|
||||
error->all(FLERR,
|
||||
"Must define dihedral_style before AngleTorsion Coeffs");
|
||||
if (firstpass) dihedralcoeffs(3);
|
||||
@ -685,7 +685,7 @@ void ReadData::command(int narg, char **arg)
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,
|
||||
"Invalid data file section: AngleAngleTorsion Coeffs");
|
||||
if (force->dihedral == NULL)
|
||||
if (force->dihedral == nullptr)
|
||||
error->all(FLERR,
|
||||
"Must define dihedral_style before "
|
||||
"AngleAngleTorsion Coeffs");
|
||||
@ -694,7 +694,7 @@ void ReadData::command(int narg, char **arg)
|
||||
} else if (strcmp(keyword,"BondBond13 Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: BondBond13 Coeffs");
|
||||
if (force->dihedral == NULL)
|
||||
if (force->dihedral == nullptr)
|
||||
error->all(FLERR,
|
||||
"Must define dihedral_style before BondBond13 Coeffs");
|
||||
if (firstpass) dihedralcoeffs(5);
|
||||
@ -703,7 +703,7 @@ void ReadData::command(int narg, char **arg)
|
||||
} else if (strcmp(keyword,"AngleAngle Coeffs") == 0) {
|
||||
if (atom->avec->impropers_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: AngleAngle Coeffs");
|
||||
if (force->improper == NULL)
|
||||
if (force->improper == nullptr)
|
||||
error->all(FLERR,
|
||||
"Must define improper_style before AngleAngle Coeffs");
|
||||
if (firstpass) impropercoeffs(1);
|
||||
@ -725,7 +725,7 @@ void ReadData::command(int narg, char **arg)
|
||||
if (me == 0) {
|
||||
if (compressed) pclose(fp);
|
||||
else fclose(fp);
|
||||
fp = NULL;
|
||||
fp = nullptr;
|
||||
}
|
||||
|
||||
// done if this was 2nd pass
|
||||
@ -929,7 +929,7 @@ void ReadData::header(int firstpass)
|
||||
|
||||
if (me == 0) {
|
||||
char *eof = fgets(line,MAXLINE,fp);
|
||||
if (eof == NULL) error->one(FLERR,"Unexpected end of data file");
|
||||
if (eof == nullptr) error->one(FLERR,"Unexpected end of data file");
|
||||
}
|
||||
|
||||
while (1) {
|
||||
@ -937,7 +937,7 @@ void ReadData::header(int firstpass)
|
||||
// read a line and bcast length
|
||||
|
||||
if (me == 0) {
|
||||
if (fgets(line,MAXLINE,fp) == NULL) n = 0;
|
||||
if (fgets(line,MAXLINE,fp) == nullptr) n = 0;
|
||||
else n = strlen(line) + 1;
|
||||
}
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
@ -1289,7 +1289,7 @@ void ReadData::bonds(int firstpass)
|
||||
// allocate count if firstpass
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
int *count = NULL;
|
||||
int *count = nullptr;
|
||||
if (firstpass) {
|
||||
memory->create(count,nlocal,"read_data:count");
|
||||
memset(count,0,nlocal*sizeof(int));
|
||||
@ -1363,7 +1363,7 @@ void ReadData::angles(int firstpass)
|
||||
// allocate count if firstpass
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
int *count = NULL;
|
||||
int *count = nullptr;
|
||||
if (firstpass) {
|
||||
memory->create(count,nlocal,"read_data:count");
|
||||
memset(count,0,nlocal*sizeof(int));
|
||||
@ -1437,7 +1437,7 @@ void ReadData::dihedrals(int firstpass)
|
||||
// allocate count if firstpass
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
int *count = NULL;
|
||||
int *count = nullptr;
|
||||
if (firstpass) {
|
||||
memory->create(count,nlocal,"read_data:count");
|
||||
memset(count,0,nlocal*sizeof(int));
|
||||
@ -1511,7 +1511,7 @@ void ReadData::impropers(int firstpass)
|
||||
// allocate count if firstpass
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
int *count = NULL;
|
||||
int *count = nullptr;
|
||||
if (firstpass) {
|
||||
memory->create(count,nlocal,"read_data:count");
|
||||
memset(count,0,nlocal*sizeof(int));
|
||||
@ -1641,7 +1641,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr)
|
||||
|
||||
while (nchunk < nmax && nline <= CHUNK-MAXBODY) {
|
||||
eof = fgets(&buffer[m],MAXLINE,fp);
|
||||
if (eof == NULL) error->one(FLERR,"Unexpected end of data file");
|
||||
if (eof == nullptr) error->one(FLERR,"Unexpected end of data file");
|
||||
rv = sscanf(&buffer[m],"%d %d %d",&tmp,&ninteger,&ndouble);
|
||||
if (rv != 3)
|
||||
error->one(FLERR,"Incorrect format in Bodies section of data file");
|
||||
@ -1655,7 +1655,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr)
|
||||
nword = 0;
|
||||
while (nword < ninteger) {
|
||||
eof = fgets(&buffer[m],MAXLINE,fp);
|
||||
if (eof == NULL) error->one(FLERR,"Unexpected end of data file");
|
||||
if (eof == nullptr) error->one(FLERR,"Unexpected end of data file");
|
||||
ncount = utils::trim_and_count_words(&buffer[m]);
|
||||
if (ncount == 0)
|
||||
error->one(FLERR,"Too few values in body lines in data file");
|
||||
@ -1669,7 +1669,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr)
|
||||
nword = 0;
|
||||
while (nword < ndouble) {
|
||||
eof = fgets(&buffer[m],MAXLINE,fp);
|
||||
if (eof == NULL) error->one(FLERR,"Unexpected end of data file");
|
||||
if (eof == nullptr) error->one(FLERR,"Unexpected end of data file");
|
||||
ncount = utils::trim_and_count_words(&buffer[m]);
|
||||
if (ncount == 0)
|
||||
error->one(FLERR,"Too few values in body lines in data file");
|
||||
@ -1743,7 +1743,7 @@ void ReadData::paircoeffs()
|
||||
for (int i = 0; i < ntypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
parse_coeffs(buf,NULL,1,2,toffset);
|
||||
parse_coeffs(buf,nullptr,1,2,toffset);
|
||||
if (narg == 0)
|
||||
error->all(FLERR,"Unexpected empty line in PairCoeffs section");
|
||||
force->pair->coeff(narg,arg);
|
||||
@ -1770,7 +1770,7 @@ void ReadData::pairIJcoeffs()
|
||||
for (j = i; j < ntypes; j++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
parse_coeffs(buf,NULL,0,2,toffset);
|
||||
parse_coeffs(buf,nullptr,0,2,toffset);
|
||||
if (narg == 0)
|
||||
error->all(FLERR,"Unexpected empty line in PairCoeffs section");
|
||||
force->pair->coeff(narg,arg);
|
||||
@ -1795,7 +1795,7 @@ void ReadData::bondcoeffs()
|
||||
for (int i = 0; i < nbondtypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
parse_coeffs(buf,NULL,0,1,boffset);
|
||||
parse_coeffs(buf,nullptr,0,1,boffset);
|
||||
if (narg == 0)
|
||||
error->all(FLERR,"Unexpected empty line in BondCoeffs section");
|
||||
force->bond->coeff(narg,arg);
|
||||
@ -1820,7 +1820,7 @@ void ReadData::anglecoeffs(int which)
|
||||
for (int i = 0; i < nangletypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
if (which == 0) parse_coeffs(buf,NULL,0,1,aoffset);
|
||||
if (which == 0) parse_coeffs(buf,nullptr,0,1,aoffset);
|
||||
else if (which == 1) parse_coeffs(buf,"bb",0,1,aoffset);
|
||||
else if (which == 2) parse_coeffs(buf,"ba",0,1,aoffset);
|
||||
if (narg == 0) error->all(FLERR,"Unexpected empty line in AngleCoeffs section");
|
||||
@ -1846,7 +1846,7 @@ void ReadData::dihedralcoeffs(int which)
|
||||
for (int i = 0; i < ndihedraltypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
if (which == 0) parse_coeffs(buf,NULL,0,1,doffset);
|
||||
if (which == 0) parse_coeffs(buf,nullptr,0,1,doffset);
|
||||
else if (which == 1) parse_coeffs(buf,"mbt",0,1,doffset);
|
||||
else if (which == 2) parse_coeffs(buf,"ebt",0,1,doffset);
|
||||
else if (which == 3) parse_coeffs(buf,"at",0,1,doffset);
|
||||
@ -1876,7 +1876,7 @@ void ReadData::impropercoeffs(int which)
|
||||
for (int i = 0; i < nimpropertypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
if (which == 0) parse_coeffs(buf,NULL,0,1,ioffset);
|
||||
if (which == 0) parse_coeffs(buf,nullptr,0,1,ioffset);
|
||||
else if (which == 1) parse_coeffs(buf,"aa",0,1,ioffset);
|
||||
if (narg == 0) error->all(FLERR,"Unexpected empty line in ImproperCoeffs section");
|
||||
force->improper->coeff(narg,arg);
|
||||
@ -1945,7 +1945,7 @@ void ReadData::open(char *file)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (fp == NULL)
|
||||
if (fp == nullptr)
|
||||
error->one(FLERR,fmt::format("Cannot open file {}: {}",
|
||||
file, utils::getsyserror()));
|
||||
}
|
||||
@ -1970,15 +1970,15 @@ void ReadData::parse_keyword(int first)
|
||||
|
||||
if (me == 0) {
|
||||
if (!first) {
|
||||
if (fgets(line,MAXLINE,fp) == NULL) eof = 1;
|
||||
if (fgets(line,MAXLINE,fp) == nullptr) eof = 1;
|
||||
}
|
||||
while (eof == 0 && done == 0) {
|
||||
int blank = strspn(line," \t\n\r");
|
||||
if ((blank == (int)strlen(line)) || (line[blank] == '#')) {
|
||||
if (fgets(line,MAXLINE,fp) == NULL) eof = 1;
|
||||
if (fgets(line,MAXLINE,fp) == nullptr) eof = 1;
|
||||
} else done = 1;
|
||||
}
|
||||
if (fgets(buffer,MAXLINE,fp) == NULL) {
|
||||
if (fgets(buffer,MAXLINE,fp) == nullptr) {
|
||||
eof = 1;
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
@ -2031,16 +2031,16 @@ void ReadData::skip_lines(bigint n)
|
||||
{
|
||||
if (me) return;
|
||||
if (n <= 0) return;
|
||||
char *eof = NULL;
|
||||
char *eof = nullptr;
|
||||
for (bigint i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp);
|
||||
if (eof == NULL) error->one(FLERR,"Unexpected end of data file");
|
||||
if (eof == nullptr) error->one(FLERR,"Unexpected end of data file");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
parse a line of coeffs into words, storing them in narg,arg
|
||||
trim anything from '#' onward
|
||||
word strings remain in line, are not copied
|
||||
if addstr != NULL, add addstr as extra arg for class2 angle/dihedral/improper
|
||||
if addstr != nullptr, add addstr as extra arg for class2 angle/dihedral/improper
|
||||
if 2nd word starts with letter, then is hybrid style, add addstr after it
|
||||
else add addstr before 2nd word
|
||||
if dupflag, duplicate 1st word, so pair_coeff "2" becomes "2 2"
|
||||
@ -2065,7 +2065,7 @@ void ReadData::parse_coeffs(char *line, const char *addstr,
|
||||
arg[narg++] = word;
|
||||
if (addstr && narg == 2 && islower(word[0])) arg[narg++] = (char *) addstr;
|
||||
if (dupflag && narg == 1) arg[narg++] = word;
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
word = strtok(nullptr," \t\n\r\f");
|
||||
}
|
||||
|
||||
// to avoid segfaults on empty lines
|
||||
@ -2094,12 +2094,12 @@ int ReadData::style_match(const char *one, const char *two)
|
||||
{
|
||||
int i,delta,len,len1,len2;
|
||||
|
||||
if ((one == NULL) || (two == NULL)) return 1;
|
||||
if ((one == nullptr) || (two == nullptr)) return 1;
|
||||
|
||||
len1 = strlen(one);
|
||||
len2 = strlen(two);
|
||||
|
||||
for (i = 0; suffixes[i] != NULL; i++) {
|
||||
for (i = 0; suffixes[i] != nullptr; i++) {
|
||||
len = strlen(suffixes[i]);
|
||||
if ((delta = len1 - len) > 0)
|
||||
if (strcmp(one+delta,suffixes[i]) == 0) len1 = delta;
|
||||
|
||||
Reference in New Issue
Block a user