Port to C++11 nullptr keyword

Performed using modernize-use-nullptr from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
time-shift
Sébastien Villemot 2019-01-09 16:25:31 +01:00
parent 7df31f68d9
commit 9656904d41
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
47 changed files with 180 additions and 180 deletions

View File

@ -4,8 +4,8 @@
#include "symmetry.hh" #include "symmetry.hh"
prodpit::prodpit() prodpit::prodpit()
: prodq(NULL), jseq(NULL), : prodq(nullptr), jseq(nullptr),
sig(NULL), p(NULL) sig(nullptr), p(nullptr)
{ {
} }
@ -33,15 +33,15 @@ prodpit::prodpit(const prodpit &ppit)
if (ppit.jseq) if (ppit.jseq)
jseq = new IntSequence(*(ppit.jseq)); jseq = new IntSequence(*(ppit.jseq));
else else
jseq = NULL; jseq = nullptr;
if (ppit.sig) if (ppit.sig)
sig = new ParameterSignal(*(ppit.sig)); sig = new ParameterSignal(*(ppit.sig));
else else
sig = NULL; sig = nullptr;
if (ppit.p) if (ppit.p)
p = new Vector(*(ppit.p)); p = new Vector(*(ppit.p));
else else
p = NULL; p = nullptr;
} }
prodpit::~prodpit() prodpit::~prodpit()
@ -60,8 +60,8 @@ prodpit::operator==(const prodpit &ppit) const
bool ret = true; bool ret = true;
ret = ret & prodq == ppit.prodq; ret = ret & prodq == ppit.prodq;
ret = ret & end_flag == ppit.end_flag; ret = ret & end_flag == ppit.end_flag;
ret = ret & ((jseq == NULL && ppit.jseq == NULL) ret = ret & ((jseq == nullptr && ppit.jseq == nullptr)
|| (jseq != NULL && ppit.jseq != NULL && *jseq == *(ppit.jseq))); || (jseq != nullptr && ppit.jseq != nullptr && *jseq == *(ppit.jseq)));
return ret; return ret;
} }
@ -82,15 +82,15 @@ prodpit::operator=(const prodpit &ppit)
if (ppit.jseq) if (ppit.jseq)
jseq = new IntSequence(*(ppit.jseq)); jseq = new IntSequence(*(ppit.jseq));
else else
jseq = NULL; jseq = nullptr;
if (ppit.sig) if (ppit.sig)
sig = new ParameterSignal(*(ppit.sig)); sig = new ParameterSignal(*(ppit.sig));
else else
sig = NULL; sig = nullptr;
if (ppit.p) if (ppit.p)
p = new Vector(*(ppit.p)); p = new Vector(*(ppit.p));
else else
p = NULL; p = nullptr;
return *this; return *this;
} }

View File

@ -188,7 +188,7 @@ public:
savePoints(const char *fname, int level) const savePoints(const char *fname, int level) const
{ {
FILE *fd; FILE *fd;
if (NULL == (fd = fopen(fname, "w"))) if (nullptr == (fd = fopen(fname, "w")))
{ {
// todo: raise // todo: raise
fprintf(stderr, "Cannot open file %s for writing.\n", fname); fprintf(stderr, "Cannot open file %s for writing.\n", fname);

View File

@ -162,7 +162,7 @@ HaltonSequence::print() const
} }
qmcpit::qmcpit() qmcpit::qmcpit()
: spec(NULL), halton(NULL), sig(NULL) : spec(nullptr), halton(nullptr), sig(nullptr)
{ {
} }
@ -173,7 +173,7 @@ qmcpit::qmcpit(const QMCSpecification &s, int n)
} }
qmcpit::qmcpit(const qmcpit &qpit) qmcpit::qmcpit(const qmcpit &qpit)
: spec(qpit.spec), halton(NULL), sig(NULL) : spec(qpit.spec), halton(nullptr), sig(nullptr)
{ {
if (qpit.halton) if (qpit.halton)
halton = new HaltonSequence(*(qpit.halton)); halton = new HaltonSequence(*(qpit.halton));
@ -193,8 +193,8 @@ bool
qmcpit::operator==(const qmcpit &qpit) const qmcpit::operator==(const qmcpit &qpit) const
{ {
return (spec == qpit.spec) return (spec == qpit.spec)
&& ((halton == NULL && qpit.halton == NULL) && ((halton == nullptr && qpit.halton == nullptr)
|| (halton != NULL && qpit.halton != NULL && halton->getNum() == qpit.halton->getNum())); || (halton != nullptr && qpit.halton != nullptr && halton->getNum() == qpit.halton->getNum()));
} }
const qmcpit & const qmcpit &
@ -206,7 +206,7 @@ qmcpit::operator=(const qmcpit &qpit)
if (qpit.halton) if (qpit.halton)
halton = new HaltonSequence(*(qpit.halton)); halton = new HaltonSequence(*(qpit.halton));
else else
halton = NULL; halton = nullptr;
return *this; return *this;
} }
@ -225,7 +225,7 @@ qmcpit::weight() const
} }
qmcnpit::qmcnpit() qmcnpit::qmcnpit()
: qmcpit(), pnt(NULL) : qmcpit(), pnt(nullptr)
{ {
} }
@ -235,7 +235,7 @@ qmcnpit::qmcnpit(const QMCSpecification &s, int n)
} }
qmcnpit::qmcnpit(const qmcnpit &qpit) qmcnpit::qmcnpit(const qmcnpit &qpit)
: qmcpit(qpit), pnt(NULL) : qmcpit(qpit), pnt(nullptr)
{ {
if (qpit.pnt) if (qpit.pnt)
pnt = new Vector(*(qpit.pnt)); pnt = new Vector(*(qpit.pnt));
@ -256,7 +256,7 @@ qmcnpit::operator=(const qmcnpit &qpit)
if (qpit.pnt) if (qpit.pnt)
pnt = new Vector(*(qpit.pnt)); pnt = new Vector(*(qpit.pnt));
else else
pnt = NULL; pnt = nullptr;
return *this; return *this;
} }

View File

@ -4,7 +4,7 @@
#include "symmetry.hh" #include "symmetry.hh"
smolpit::smolpit() smolpit::smolpit()
: smolq(NULL), jseq(NULL), sig(NULL), p(NULL) : smolq(nullptr), jseq(nullptr), sig(nullptr), p(nullptr)
{ {
} }
@ -28,15 +28,15 @@ smolpit::smolpit(const smolpit &spit)
if (spit.jseq) if (spit.jseq)
jseq = new IntSequence(*(spit.jseq)); jseq = new IntSequence(*(spit.jseq));
else else
jseq = NULL; jseq = nullptr;
if (spit.sig) if (spit.sig)
sig = new ParameterSignal(*(spit.sig)); sig = new ParameterSignal(*(spit.sig));
else else
sig = NULL; sig = nullptr;
if (spit.p) if (spit.p)
p = new Vector(*(spit.p)); p = new Vector(*(spit.p));
else else
p = NULL; p = nullptr;
} }
smolpit::~smolpit() smolpit::~smolpit()
@ -55,8 +55,8 @@ smolpit::operator==(const smolpit &spit) const
bool ret = true; bool ret = true;
ret = ret & smolq == spit.smolq; ret = ret & smolq == spit.smolq;
ret = ret & isummand == spit.isummand; ret = ret & isummand == spit.isummand;
ret = ret & ((jseq == NULL && spit.jseq == NULL) ret = ret & ((jseq == nullptr && spit.jseq == nullptr)
|| (jseq != NULL && spit.jseq != NULL && *jseq == *(spit.jseq))); || (jseq != nullptr && spit.jseq != nullptr && *jseq == *(spit.jseq)));
return ret; return ret;
} }
@ -77,15 +77,15 @@ smolpit::operator=(const smolpit &spit)
if (spit.jseq) if (spit.jseq)
jseq = new IntSequence(*(spit.jseq)); jseq = new IntSequence(*(spit.jseq));
else else
jseq = NULL; jseq = nullptr;
if (spit.sig) if (spit.sig)
sig = new ParameterSignal(*(spit.sig)); sig = new ParameterSignal(*(spit.sig));
else else
sig = NULL; sig = nullptr;
if (spit.p) if (spit.p)
p = new Vector(*(spit.p)); p = new Vector(*(spit.p));
else else
p = NULL; p = nullptr;
return *this; return *this;
} }

View File

@ -29,7 +29,7 @@ private:
}; };
QuadParams::QuadParams(int argc, char **argv) QuadParams::QuadParams(int argc, char **argv)
: outname(NULL), vcovname(NULL), max_level(3), discard_weight(0.0) : outname(nullptr), vcovname(nullptr), max_level(3), discard_weight(0.0)
{ {
if (argc == 1) if (argc == 1)
{ {
@ -41,10 +41,10 @@ QuadParams::QuadParams(int argc, char **argv)
argc--; argc--;
struct option const opts [] = { struct option const opts [] = {
{"max-level", required_argument, NULL, opt_max_level}, {"max-level", required_argument, nullptr, opt_max_level},
{"discard-weight", required_argument, NULL, opt_discard_weight}, {"discard-weight", required_argument, nullptr, opt_discard_weight},
{"vcov", required_argument, NULL, opt_vcov}, {"vcov", required_argument, nullptr, opt_vcov},
{NULL, 0, NULL, 0} {nullptr, 0, nullptr, 0}
}; };
int ret; int ret;
@ -73,13 +73,13 @@ QuadParams::QuadParams(int argc, char **argv)
void void
QuadParams::check_consistency() const QuadParams::check_consistency() const
{ {
if (outname == NULL) if (outname == nullptr)
{ {
fprintf(stderr, "Error: output name not set\n"); fprintf(stderr, "Error: output name not set\n");
exit(1); exit(1);
} }
if (vcovname == NULL) if (vcovname == nullptr)
{ {
fprintf(stderr, "Error: vcov file name not set\n"); fprintf(stderr, "Error: vcov file name not set\n");
exit(1); exit(1);
@ -104,7 +104,7 @@ main(int argc, char **argv)
// open output file for writing // open output file for writing
FILE *fout; FILE *fout;
if (NULL == (fout = fopen(params.outname, "w"))) if (nullptr == (fout = fopen(params.outname, "w")))
{ {
fprintf(stderr, "Could not open %s for writing\n", params.outname); fprintf(stderr, "Could not open %s for writing\n", params.outname);
exit(1); exit(1);

View File

@ -172,12 +172,12 @@ class WallTimer
public: public:
WallTimer(const char *m, bool nl = true) WallTimer(const char *m, bool nl = true)
{ {
strcpy(mes, m); new_line = nl; gettimeofday(&start, NULL); strcpy(mes, m); new_line = nl; gettimeofday(&start, nullptr);
} }
~WallTimer() ~WallTimer()
{ {
struct timeval end; struct timeval end;
gettimeofday(&end, NULL); gettimeofday(&end, nullptr);
printf("%s%8.4g", mes, printf("%s%8.4g", mes,
end.tv_sec-start.tv_sec + (end.tv_usec-start.tv_usec)*1.0e-6); end.tv_sec-start.tv_sec + (end.tv_usec-start.tv_usec)*1.0e-6);
if (new_line) if (new_line)

View File

@ -30,7 +30,7 @@ ZAuxContainer::getType(int i, const Symmetry &s) const
} }
Approximation::Approximation(DynamicModel &m, Journal &j, int ns, bool dr_centr, double qz_crit) Approximation::Approximation(DynamicModel &m, Journal &j, int ns, bool dr_centr, double qz_crit)
: model(m), journal(j), rule_ders(NULL), rule_ders_ss(NULL), fdr(NULL), udr(NULL), : model(m), journal(j), rule_ders(nullptr), rule_ders_ss(nullptr), fdr(nullptr), udr(nullptr),
ypart(model.nstat(), model.npred(), model.nboth(), model.nforw()), ypart(model.nstat(), model.npred(), model.nboth(), model.nforw()),
mom(UNormalMoments(model.order(), model.getVcov())), nvs(4), steps(ns), mom(UNormalMoments(model.order(), model.getVcov())), nvs(4), steps(ns),
dr_centralize(dr_centr), qz_criterium(qz_crit), ss(ypart.ny(), steps+1) dr_centralize(dr_centr), qz_criterium(qz_crit), ss(ypart.ny(), steps+1)
@ -57,7 +57,7 @@ Approximation::~Approximation()
const FoldDecisionRule & const FoldDecisionRule &
Approximation::getFoldDecisionRule() const Approximation::getFoldDecisionRule() const
{ {
KORD_RAISE_IF(fdr == NULL, KORD_RAISE_IF(fdr == nullptr,
"Folded decision rule has not been created in Approximation::getFoldDecisionRule"); "Folded decision rule has not been created in Approximation::getFoldDecisionRule");
return *fdr; return *fdr;
} }
@ -66,7 +66,7 @@ Approximation::getFoldDecisionRule() const
const UnfoldDecisionRule & const UnfoldDecisionRule &
Approximation::getUnfoldDecisionRule() const Approximation::getUnfoldDecisionRule() const
{ {
KORD_RAISE_IF(udr == NULL, KORD_RAISE_IF(udr == nullptr,
"Unfolded decision rule has not been created in Approximation::getUnfoldDecisionRule"); "Unfolded decision rule has not been created in Approximation::getUnfoldDecisionRule");
return *udr; return *udr;
} }
@ -208,12 +208,12 @@ Approximation::walkStochSteady()
if (fdr) if (fdr)
{ {
delete fdr; delete fdr;
fdr = NULL; fdr = nullptr;
} }
if (udr) if (udr)
{ {
delete udr; delete udr;
udr = NULL; udr = nullptr;
} }
fdr = new FoldDecisionRule(*rule_ders, ypart, model.nexog(), fdr = new FoldDecisionRule(*rule_ders, ypart, model.nexog(),

View File

@ -132,8 +132,8 @@ SimResults::writeMat(const char *base, const char *lname) const
{ {
char matfile_name[100]; char matfile_name[100];
sprintf(matfile_name, "%s.mat", base); sprintf(matfile_name, "%s.mat", base);
mat_t *matfd = Mat_Create(matfile_name, NULL); mat_t *matfd = Mat_Create(matfile_name, nullptr);
if (matfd != NULL) if (matfd != nullptr)
{ {
writeMat(matfd, lname); writeMat(matfd, lname);
Mat_Close(matfd); Mat_Close(matfd);

View File

@ -534,7 +534,7 @@ template <int t>
DRFixPoint<t>::DRFixPoint(const _Tg &g, const PartitionY &yp, DRFixPoint<t>::DRFixPoint(const _Tg &g, const PartitionY &yp,
const Vector &ys, double sigma) const Vector &ys, double sigma)
: ctraits<t>::Tpol(yp.ny(), yp.nys()), : ctraits<t>::Tpol(yp.ny(), yp.nys()),
ysteady(ys), ypart(yp), bigf(NULL), bigfder(NULL) ysteady(ys), ypart(yp), bigf(nullptr), bigfder(nullptr)
{ {
fillTensors(g, sigma); fillTensors(g, sigma);
_Tparent yspol(ypart.nstat, ypart.nys(), *this); _Tparent yspol(ypart.nstat, ypart.nys(), *this);

View File

@ -16,13 +16,13 @@
ResidFunction::ResidFunction(const Approximation &app) ResidFunction::ResidFunction(const Approximation &app)
: VectorFunction(app.getModel().nexog(), app.getModel().numeq()), approx(app), : VectorFunction(app.getModel().nexog(), app.getModel().numeq()), approx(app),
model(app.getModel().clone()), model(app.getModel().clone()),
yplus(NULL), ystar(NULL), u(NULL), hss(NULL) yplus(nullptr), ystar(nullptr), u(nullptr), hss(nullptr)
{ {
} }
ResidFunction::ResidFunction(const ResidFunction &rf) ResidFunction::ResidFunction(const ResidFunction &rf)
: VectorFunction(rf), approx(rf.approx), model(rf.model->clone()), : VectorFunction(rf), approx(rf.approx), model(rf.model->clone()),
yplus(NULL), ystar(NULL), u(NULL), hss(NULL) yplus(nullptr), ystar(nullptr), u(nullptr), hss(nullptr)
{ {
if (rf.yplus) if (rf.yplus)
yplus = new Vector(*(rf.yplus)); yplus = new Vector(*(rf.yplus));

View File

@ -67,7 +67,7 @@ sysconf(int name)
SystemResources::SystemResources() SystemResources::SystemResources()
{ {
gettimeofday(&start, NULL); gettimeofday(&start, nullptr);
} }
long int long int
@ -103,7 +103,7 @@ SystemResources::getRUS(double &load_avg, long int &pg_avail,
long int &idrss, long int &majflt) long int &idrss, long int &majflt)
{ {
struct timeval now; struct timeval now;
gettimeofday(&now, NULL); gettimeofday(&now, nullptr);
elapsed = now.tv_sec-start.tv_sec + (now.tv_usec-start.tv_usec)*1.0e-6; elapsed = now.tv_sec-start.tv_sec + (now.tv_usec-start.tv_usec)*1.0e-6;
#if !defined(__MINGW32__) #if !defined(__MINGW32__)
@ -239,7 +239,7 @@ Journal::printHeader()
(*this)<< "\n\nStart time: "; (*this)<< "\n\nStart time: ";
char ts[100]; char ts[100];
time_t curtime = time(NULL); time_t curtime = time(nullptr);
tm loctime; tm loctime;
localtime_r(&curtime, &loctime); localtime_r(&curtime, &loctime);
asctime_r(&loctime, ts); asctime_r(&loctime, ts);

View File

@ -29,7 +29,7 @@ KOrderStoch::KOrderStoch(const PartitionY &yp, int nu,
const FGSContainer &hh, Journal &jr) const FGSContainer &hh, Journal &jr)
: nvs(4), ypart(yp), journal(jr), : nvs(4), ypart(yp), journal(jr),
_ug(4), _fg(4), _ugs(4), _fgs(4), _uG(4), _fG(4), _ug(4), _fg(4), _ugs(4), _fgs(4), _uG(4), _fG(4),
_uh(NULL), _fh(&hh), _uh(nullptr), _fh(&hh),
_uZstack(&_uG, ypart.nyss(), &_ug, ypart.ny(), ypart.nys(), nu), _uZstack(&_uG, ypart.nyss(), &_ug, ypart.ny(), ypart.nys(), nu),
_fZstack(&_fG, ypart.nyss(), &_fg, ypart.ny(), ypart.nys(), nu), _fZstack(&_fG, ypart.nyss(), &_fg, ypart.ny(), ypart.nys(), nu),
_uGstack(&_ugs, ypart.nys(), nu), _uGstack(&_ugs, ypart.nys(), nu),
@ -50,7 +50,7 @@ KOrderStoch::KOrderStoch(const PartitionY &yp, int nu,
const UGSContainer &hh, Journal &jr) const UGSContainer &hh, Journal &jr)
: nvs(4), ypart(yp), journal(jr), : nvs(4), ypart(yp), journal(jr),
_ug(4), _fg(4), _ugs(4), _fgs(4), _uG(4), _fG(4), _ug(4), _fg(4), _ugs(4), _fgs(4), _uG(4), _fG(4),
_uh(&hh), _fh(NULL), _uh(&hh), _fh(nullptr),
_uZstack(&_uG, ypart.nyss(), &_ug, ypart.ny(), ypart.nys(), nu), _uZstack(&_uG, ypart.nyss(), &_ug, ypart.ny(), ypart.nys(), nu),
_fZstack(&_fG, ypart.nyss(), &_fg, ypart.ny(), ypart.nys(), nu), _fZstack(&_fG, ypart.nyss(), &_fg, ypart.ny(), ypart.nys(), nu),
_uGstack(&_ugs, ypart.nys(), nu), _uGstack(&_ugs, ypart.nys(), nu),

View File

@ -35,7 +35,7 @@ AtomSubstitutions::add_substitution(const char *newname, const char *oldname, in
// make sure the storage is from the new_atoms // make sure the storage is from the new_atoms
newname = new_atoms.get_name_storage().query(newname); newname = new_atoms.get_name_storage().query(newname);
oldname = new_atoms.get_name_storage().query(oldname); oldname = new_atoms.get_name_storage().query(oldname);
if (newname == NULL || oldname == NULL) if (newname == nullptr || oldname == nullptr)
throw ogu::Exception(__FILE__, __LINE__, throw ogu::Exception(__FILE__, __LINE__,
"Bad newname or oldname in AtomSubstitutions::add_substitution"); "Bad newname or oldname in AtomSubstitutions::add_substitution");
@ -88,7 +88,7 @@ AtomSubstitutions::get_new4old(const char *oldname, int tshift) const
if (itt.second == -tshift) if (itt.second == -tshift)
return itt.first; return itt.first;
} }
return NULL; return nullptr;
} }
void void
@ -114,19 +114,19 @@ SAtoms::substituteAllLagsAndLeads(FormulaParser &fp, AtomSubstitutions &as)
endovarspan(mlead, mlag); endovarspan(mlead, mlag);
// substitute all endo lagged more than 1 // substitute all endo lagged more than 1
while (NULL != (name = findEndoWithLeadInInterval(mlag, -2))) while (nullptr != (name = findEndoWithLeadInInterval(mlag, -2)))
makeAuxVariables(name, -1, -2, mlag, fp, as); makeAuxVariables(name, -1, -2, mlag, fp, as);
// substitute all endo leaded more than 1 // substitute all endo leaded more than 1
while (NULL != (name = findEndoWithLeadInInterval(2, mlead))) while (nullptr != (name = findEndoWithLeadInInterval(2, mlead)))
makeAuxVariables(name, 1, 2, mlead, fp, as); makeAuxVariables(name, 1, 2, mlead, fp, as);
exovarspan(mlead, mlag); exovarspan(mlead, mlag);
// substitute all lagged exo // substitute all lagged exo
while (NULL != (name = findExoWithLeadInInterval(mlag, -1))) while (nullptr != (name = findExoWithLeadInInterval(mlag, -1)))
makeAuxVariables(name, -1, -1, mlag, fp, as); makeAuxVariables(name, -1, -1, mlag, fp, as);
// substitute all leaded exo // substitute all leaded exo
while (NULL != (name = findExoWithLeadInInterval(1, mlead))) while (nullptr != (name = findExoWithLeadInInterval(1, mlead)))
makeAuxVariables(name, 1, 1, mlead, fp, as); makeAuxVariables(name, 1, 1, mlead, fp, as);
// notify that substitution have been finished // notify that substitution have been finished
@ -142,16 +142,16 @@ SAtoms::substituteAllLagsAndExo1Leads(FormulaParser &fp, AtomSubstitutions &as)
endovarspan(mlead, mlag); endovarspan(mlead, mlag);
// substitute all endo lagged more than 1 // substitute all endo lagged more than 1
while (NULL != (name = findEndoWithLeadInInterval(mlag, -2))) while (nullptr != (name = findEndoWithLeadInInterval(mlag, -2)))
makeAuxVariables(name, -1, -2, mlag, fp, as); makeAuxVariables(name, -1, -2, mlag, fp, as);
exovarspan(mlead, mlag); exovarspan(mlead, mlag);
// substitute all lagged exo // substitute all lagged exo
while (NULL != (name = findExoWithLeadInInterval(mlag, -1))) while (nullptr != (name = findExoWithLeadInInterval(mlag, -1)))
makeAuxVariables(name, -1, -1, mlag, fp, as); makeAuxVariables(name, -1, -1, mlag, fp, as);
// substitute all leaded exo by 1 // substitute all leaded exo by 1
while (NULL != (name = findExoWithLeadInInterval(1, 1))) while (nullptr != (name = findExoWithLeadInInterval(1, 1)))
makeAuxVariables(name, 1, 1, 1, fp, as); makeAuxVariables(name, 1, 1, 1, fp, as);
// notify that substitution have been finished // notify that substitution have been finished
@ -175,7 +175,7 @@ SAtoms::findNameWithLeadInInterval(const vector<const char *> &names,
} }
// nothing found // nothing found
return NULL; return nullptr;
} }
void void
@ -242,7 +242,7 @@ SAtoms::makeAuxVariables(const char *name, int step, int start, int limit_lead,
const char *newname; const char *newname;
string newname_str; string newname_str;
int taux; int taux;
if (NULL == (newname = as.get_new4old(name, ll-step))) if (nullptr == (newname = as.get_new4old(name, ll-step)))
{ {
attemptAuxName(name, ll-step, newname_str); attemptAuxName(name, ll-step, newname_str);
newname = newname_str.c_str(); newname = newname_str.c_str();

View File

@ -40,5 +40,5 @@ CSVParser::csv_parse(int length, const char *str)
::csv_parse(); ::csv_parse();
delete [] buffer; delete [] buffer;
csv__destroy_buffer(p); csv__destroy_buffer(p);
parsed_string = NULL; parsed_string = nullptr;
} }

View File

@ -25,7 +25,7 @@ namespace ogp
const char *parsed_string; const char *parsed_string;
public: public:
CSVParser(CSVParserPeer &p) CSVParser(CSVParserPeer &p)
: peer(p), row(0), col(0), parsed_string(0) : peer(p), row(0), col(0), parsed_string(nullptr)
{ {
} }
CSVParser(const CSVParser &csvp) CSVParser(const CSVParser &csvp)

View File

@ -32,7 +32,7 @@ NameStorage::query(const char *name) const
{ {
auto it = name_set.find(name); auto it = name_set.find(name);
if (it == name_set.end()) if (it == name_set.end())
return NULL; return nullptr;
else else
return (*it); return (*it);
} }

View File

@ -76,7 +76,7 @@ AllvarOuterOrdering::AllvarOuterOrdering(const AllvarOuterOrdering &avo,
FineAtoms::FineAtoms(const FineAtoms &fa) FineAtoms::FineAtoms(const FineAtoms &fa)
: DynamicAtoms(fa), params(), endovars(), exovars(), : DynamicAtoms(fa), params(), endovars(), exovars(),
endo_order(NULL), exo_order(NULL), allvar_order(NULL), endo_order(nullptr), exo_order(nullptr), allvar_order(nullptr),
der_atoms(fa.der_atoms), der_atoms(fa.der_atoms),
endo_atoms_map(fa.endo_atoms_map), endo_atoms_map(fa.endo_atoms_map),
exo_atoms_map(fa.exo_atoms_map) exo_atoms_map(fa.exo_atoms_map)

View File

@ -229,7 +229,7 @@ namespace ogp
vector<int> exo_atoms_map; vector<int> exo_atoms_map;
public: public:
FineAtoms() FineAtoms()
: endo_order(NULL), exo_order(NULL), allvar_order(NULL) : endo_order(nullptr), exo_order(nullptr), allvar_order(nullptr)
{ {
} }
FineAtoms(const FineAtoms &fa); FineAtoms(const FineAtoms &fa);

View File

@ -91,7 +91,7 @@ namespace ogp
int r{0}; int r{0};
public: public:
MPIterator() : p(NULL) MPIterator() : p(nullptr)
{ {
} }
/** Constructs an iterator pointing to the beginning of the /** Constructs an iterator pointing to the beginning of the

View File

@ -48,7 +48,7 @@ ParserException::ParserException(const string &m, const char *dum, int i1, int i
} }
ParserException::ParserException(const ParserException &m, int plus_offset) ParserException::ParserException(const ParserException &m, int plus_offset)
: mes(NULL), : mes(nullptr),
aux_i1(-1), aux_i2(-1), aux_i3(-1) aux_i1(-1), aux_i2(-1), aux_i3(-1)
{ {
copy(m); copy(m);
@ -56,7 +56,7 @@ ParserException::ParserException(const ParserException &m, int plus_offset)
} }
ParserException::ParserException(const ParserException &m, const char *dum, int i) ParserException::ParserException(const ParserException &m, const char *dum, int i)
: mes(NULL), : mes(nullptr),
aux_i1(-1), aux_i2(-1), aux_i3(-1) aux_i1(-1), aux_i2(-1), aux_i3(-1)
{ {
copy(m); copy(m);
@ -66,7 +66,7 @@ ParserException::ParserException(const ParserException &m, const char *dum, int
} }
ParserException::ParserException(const ParserException &m, const char *dum, int i1, int i2) ParserException::ParserException(const ParserException &m, const char *dum, int i1, int i2)
: mes(NULL), : mes(nullptr),
aux_i1(-1), aux_i2(-1), aux_i3(-1) aux_i1(-1), aux_i2(-1), aux_i3(-1)
{ {
copy(m); copy(m);
@ -76,7 +76,7 @@ ParserException::ParserException(const ParserException &m, const char *dum, int
} }
ParserException::ParserException(const ParserException &m, const char *dum, int i1, int i2, int i3) ParserException::ParserException(const ParserException &m, const char *dum, int i1, int i2, int i3)
: mes(NULL), : mes(nullptr),
aux_i1(-1), aux_i2(-1), aux_i3(-1) aux_i1(-1), aux_i2(-1), aux_i3(-1)
{ {
copy(m); copy(m);
@ -86,7 +86,7 @@ ParserException::ParserException(const ParserException &m, const char *dum, int
} }
ParserException::ParserException(const ParserException &e) ParserException::ParserException(const ParserException &e)
: mes(NULL), : mes(nullptr),
aux_i1(-1), aux_i2(-1), aux_i3(-1) aux_i1(-1), aux_i2(-1), aux_i3(-1)
{ {
copy(e); copy(e);

View File

@ -84,7 +84,7 @@ StaticAtoms::inv_index(int t) const
{ {
auto it = indices.find(t); auto it = indices.find(t);
if (it == indices.end()) if (it == indices.end())
return NULL; return nullptr;
else else
return (*it).second; return (*it).second;
} }

View File

@ -97,7 +97,7 @@ int
StaticFineAtoms::check_variable(const char *name) const StaticFineAtoms::check_variable(const char *name) const
{ {
const char *ss = varnames.query(name); const char *ss = varnames.query(name);
if (ss == NULL) if (ss == nullptr)
throw ParserException(string("Variable <")+name+"> not declared.", 0); throw ParserException(string("Variable <")+name+"> not declared.", 0);
return index(name); return index(name);
} }
@ -208,7 +208,7 @@ void
StaticFineAtoms::register_endo(const char *name) StaticFineAtoms::register_endo(const char *name)
{ {
const char *ss = varnames.query(name); const char *ss = varnames.query(name);
if (ss == NULL) if (ss == nullptr)
throw ogp::ParserException(string("Endogenous variable <") throw ogp::ParserException(string("Endogenous variable <")
+name+"> not found in storage.", 0); +name+"> not found in storage.", 0);
endovars.push_back(ss); endovars.push_back(ss);
@ -219,7 +219,7 @@ void
StaticFineAtoms::register_exo(const char *name) StaticFineAtoms::register_exo(const char *name)
{ {
const char *ss = varnames.query(name); const char *ss = varnames.query(name);
if (ss == NULL) if (ss == nullptr)
throw ogp::ParserException(string("Exogenous variable <") throw ogp::ParserException(string("Exogenous variable <")
+name+"> not found in storage.", 0); +name+"> not found in storage.", 0);
exovars.push_back(ss); exovars.push_back(ss);
@ -230,7 +230,7 @@ void
StaticFineAtoms::register_param(const char *name) StaticFineAtoms::register_param(const char *name)
{ {
const char *ss = varnames.query(name); const char *ss = varnames.query(name);
if (ss == NULL) if (ss == nullptr)
throw ogp::ParserException(string("Parameter <")+name+"> not found in storage.", 0); throw ogp::ParserException(string("Parameter <")+name+"> not found in storage.", 0);
params.push_back(ss); params.push_back(ss);
param_outer_map.insert(Tvarintmap::value_type(ss, params.size()-1)); param_outer_map.insert(Tvarintmap::value_type(ss, params.size()-1));

View File

@ -40,8 +40,8 @@ DynareNameList::selectIndices(const vector<const char *> &ns) const
/**************************************************************************************/ /**************************************************************************************/
Dynare::Dynare(const char *modname, int ord, double sstol, Journal &jr) Dynare::Dynare(const char *modname, int ord, double sstol, Journal &jr)
: journal(jr), model(NULL), ysteady(NULL), md(1), dnl(NULL), denl(NULL), dsnl(NULL), : journal(jr), model(nullptr), ysteady(nullptr), md(1), dnl(nullptr), denl(nullptr), dsnl(nullptr),
fe(NULL), fde(NULL), ss_tol(sstol) fe(nullptr), fde(nullptr), ss_tol(sstol)
{ {
// make memory file // make memory file
ogu::MemoryFile mf(modname); ogu::MemoryFile mf(modname);
@ -77,8 +77,8 @@ Dynare::Dynare(const char **endo, int num_endo,
const char **par, int num_par, const char **par, int num_par,
const char *equations, int len, int ord, const char *equations, int len, int ord,
double sstol, Journal &jr) double sstol, Journal &jr)
: journal(jr), model(NULL), ysteady(NULL), md(1), dnl(NULL), denl(NULL), dsnl(NULL), : journal(jr), model(nullptr), ysteady(nullptr), md(1), dnl(nullptr), denl(nullptr), dsnl(nullptr),
fe(NULL), fde(NULL), ss_tol(sstol) fe(nullptr), fde(nullptr), ss_tol(sstol)
{ {
try try
{ {
@ -99,9 +99,9 @@ Dynare::Dynare(const char **endo, int num_endo,
} }
Dynare::Dynare(const Dynare &dynare) Dynare::Dynare(const Dynare &dynare)
: journal(dynare.journal), model(NULL), : journal(dynare.journal), model(nullptr),
ysteady(NULL), md(dynare.md), ysteady(nullptr), md(dynare.md),
dnl(NULL), denl(NULL), dsnl(NULL), fe(NULL), fde(NULL), dnl(nullptr), denl(nullptr), dsnl(nullptr), fe(nullptr), fde(nullptr),
ss_tol(dynare.ss_tol) ss_tol(dynare.ss_tol)
{ {
model = dynare.model->clone(); model = dynare.model->clone();

View File

@ -24,7 +24,7 @@ DynareStaticAtoms::register_name(const char *name)
int int
DynareStaticAtoms::check_variable(const char *name) const DynareStaticAtoms::check_variable(const char *name) const
{ {
if (0 == varnames.query(name)) if (nullptr == varnames.query(name))
throw ogp::ParserException(std::string("Unknown name <")+name+">", 0); throw ogp::ParserException(std::string("Unknown name <")+name+">", 0);
auto it = vars.find(name); auto it = vars.find(name);
if (it == vars.end()) if (it == vars.end())

View File

@ -27,18 +27,18 @@ ParsedMatrix::ParsedMatrix(const ogp::MatrixParser &mp)
DynareModel::DynareModel() DynareModel::DynareModel()
: atoms(), eqs(atoms), : atoms(), eqs(atoms),
pbuilder(NULL), fbuilder(NULL), pbuilder(nullptr), fbuilder(nullptr),
atom_substs(NULL), old_atoms(NULL) atom_substs(nullptr), old_atoms(nullptr)
{ {
} }
DynareModel::DynareModel(const DynareModel &dm) DynareModel::DynareModel(const DynareModel &dm)
: atoms(dm.atoms), eqs(dm.eqs, atoms), order(dm.order), : atoms(dm.atoms), eqs(dm.eqs, atoms), order(dm.order),
param_vals(0), init_vals(0), vcov_mat(0), param_vals(nullptr), init_vals(nullptr), vcov_mat(nullptr),
t_plobjective(dm.t_plobjective), t_plobjective(dm.t_plobjective),
t_pldiscount(dm.t_pldiscount), t_pldiscount(dm.t_pldiscount),
pbuilder(NULL), fbuilder(NULL), pbuilder(nullptr), fbuilder(nullptr),
atom_substs(NULL), old_atoms(NULL) atom_substs(nullptr), old_atoms(nullptr)
{ {
if (dm.param_vals) if (dm.param_vals)
param_vals = new Vector((const Vector &) *(dm.param_vals)); param_vals = new Vector((const Vector &) *(dm.param_vals));
@ -79,7 +79,7 @@ DynareModel::get_planner_info() const
{ {
if (pbuilder) if (pbuilder)
return &(pbuilder->get_info()); return &(pbuilder->get_info());
return NULL; return nullptr;
} }
const ForwSubstInfo * const ForwSubstInfo *
@ -87,7 +87,7 @@ DynareModel::get_forw_subst_info() const
{ {
if (fbuilder) if (fbuilder)
return &(fbuilder->get_info()); return &(fbuilder->get_info());
return NULL; return nullptr;
} }
const ogp::SubstInfo * const ogp::SubstInfo *
@ -95,7 +95,7 @@ DynareModel::get_subst_info() const
{ {
if (atom_substs) if (atom_substs)
return &(atom_substs->get_info()); return &(atom_substs->get_info());
return NULL; return nullptr;
} }
void void

View File

@ -84,12 +84,12 @@ namespace ogdyn
/** A vector of parameters values created by a subclass. It /** A vector of parameters values created by a subclass. It
* is stored with natural ordering (outer) of the parameters * is stored with natural ordering (outer) of the parameters
* given by atoms. */ * given by atoms. */
Vector *param_vals{0}; Vector *param_vals{nullptr};
/** A vector of initial values created by a subclass. It is /** A vector of initial values created by a subclass. It is
* stored with internal ordering given by atoms. */ * stored with internal ordering given by atoms. */
Vector *init_vals{0}; Vector *init_vals{nullptr};
/** A matrix for vcov. It is created by a subclass. */ /** A matrix for vcov. It is created by a subclass. */
TwoDMatrix *vcov_mat{0}; TwoDMatrix *vcov_mat{nullptr};
/** Tree index of the planner objective. If there was no /** Tree index of the planner objective. If there was no
* planner objective keyword, the value is set to -1. */ * planner objective keyword, the value is set to -1. */
int t_plobjective{-1}; int t_plobjective{-1};

View File

@ -46,7 +46,7 @@ const char *help_str
const char *dyn_basename(const char *str); const char *dyn_basename(const char *str);
DynareParams::DynareParams(int argc, char **argv) DynareParams::DynareParams(int argc, char **argv)
: modname(NULL), num_per(100), num_burn(0), num_sim(80), : modname(nullptr), num_per(100), num_burn(0), num_sim(80),
num_rtper(0), num_rtsim(0), num_rtper(0), num_rtsim(0),
num_condper(0), num_condsim(0), num_condper(0), num_condsim(0),
num_threads(2), num_steps(0), num_threads(2), num_steps(0),
@ -71,37 +71,37 @@ DynareParams::DynareParams(int argc, char **argv)
argc--; argc--;
struct option const opts [] = { struct option const opts [] = {
{"periods", required_argument, NULL, opt_per}, {"periods", required_argument, nullptr, opt_per},
{"per", required_argument, NULL, opt_per}, {"per", required_argument, nullptr, opt_per},
{"burn", required_argument, NULL, opt_burn}, {"burn", required_argument, nullptr, opt_burn},
{"simulations", required_argument, NULL, opt_sim}, {"simulations", required_argument, nullptr, opt_sim},
{"sim", required_argument, NULL, opt_sim}, {"sim", required_argument, nullptr, opt_sim},
{"rtperiods", required_argument, NULL, opt_rtper}, {"rtperiods", required_argument, nullptr, opt_rtper},
{"rtper", required_argument, NULL, opt_rtper}, {"rtper", required_argument, nullptr, opt_rtper},
{"rtsimulations", required_argument, NULL, opt_rtsim}, {"rtsimulations", required_argument, nullptr, opt_rtsim},
{"rtsim", required_argument, NULL, opt_rtsim}, {"rtsim", required_argument, nullptr, opt_rtsim},
{"condperiods", required_argument, NULL, opt_condper}, {"condperiods", required_argument, nullptr, opt_condper},
{"condper", required_argument, NULL, opt_condper}, {"condper", required_argument, nullptr, opt_condper},
{"condsimulations", required_argument, NULL, opt_condsim}, {"condsimulations", required_argument, nullptr, opt_condsim},
{"condsim", required_argument, NULL, opt_condsim}, {"condsim", required_argument, nullptr, opt_condsim},
{"prefix", required_argument, NULL, opt_prefix}, {"prefix", required_argument, nullptr, opt_prefix},
{"threads", required_argument, NULL, opt_threads}, {"threads", required_argument, nullptr, opt_threads},
{"steps", required_argument, NULL, opt_steps}, {"steps", required_argument, nullptr, opt_steps},
{"seed", required_argument, NULL, opt_seed}, {"seed", required_argument, nullptr, opt_seed},
{"order", required_argument, NULL, opt_order}, {"order", required_argument, nullptr, opt_order},
{"ss-tol", required_argument, NULL, opt_ss_tol}, {"ss-tol", required_argument, nullptr, opt_ss_tol},
{"check", required_argument, NULL, opt_check}, {"check", required_argument, nullptr, opt_check},
{"check-scale", required_argument, NULL, opt_check_scale}, {"check-scale", required_argument, nullptr, opt_check_scale},
{"check-evals", required_argument, NULL, opt_check_evals}, {"check-evals", required_argument, nullptr, opt_check_evals},
{"check-num", required_argument, NULL, opt_check_num}, {"check-num", required_argument, nullptr, opt_check_num},
{"qz-criterium", required_argument, NULL, opt_qz_criterium}, {"qz-criterium", required_argument, nullptr, opt_qz_criterium},
{"no-irfs", no_argument, NULL, opt_noirfs}, {"no-irfs", no_argument, nullptr, opt_noirfs},
{"irfs", no_argument, NULL, opt_irfs}, {"irfs", no_argument, nullptr, opt_irfs},
{"centralize", no_argument, NULL, opt_centralize}, {"centralize", no_argument, nullptr, opt_centralize},
{"no-centralize", no_argument, NULL, opt_no_centralize}, {"no-centralize", no_argument, nullptr, opt_no_centralize},
{"help", no_argument, NULL, opt_help}, {"help", no_argument, nullptr, opt_help},
{"version", no_argument, NULL, opt_version}, {"version", no_argument, nullptr, opt_version},
{NULL, 0, NULL, 0} {nullptr, 0, nullptr, 0}
}; };
int ret; int ret;

View File

@ -54,7 +54,7 @@ main(int argc, char **argv)
FILE *mfd; FILE *mfd;
std::string mfile1(params.basename); std::string mfile1(params.basename);
mfile1 += "_f.m"; mfile1 += "_f.m";
if (NULL == (mfd = fopen(mfile1.c_str(), "w"))) if (nullptr == (mfd = fopen(mfile1.c_str(), "w")))
{ {
fprintf(stderr, "Couldn't open %s for writing.\n", mfile1.c_str()); fprintf(stderr, "Couldn't open %s for writing.\n", mfile1.c_str());
exit(1); exit(1);
@ -65,7 +65,7 @@ main(int argc, char **argv)
std::string mfile2(params.basename); std::string mfile2(params.basename);
mfile2 += "_ff.m"; mfile2 += "_ff.m";
if (NULL == (mfd = fopen(mfile2.c_str(), "w"))) if (nullptr == (mfd = fopen(mfile2.c_str(), "w")))
{ {
fprintf(stderr, "Couldn't open %s for writing.\n", mfile2.c_str()); fprintf(stderr, "Couldn't open %s for writing.\n", mfile2.c_str());
exit(1); exit(1);
@ -77,8 +77,8 @@ main(int argc, char **argv)
// open mat file // open mat file
std::string matfile(params.basename); std::string matfile(params.basename);
matfile += ".mat"; matfile += ".mat";
mat_t *matfd = Mat_Create(matfile.c_str(), NULL); mat_t *matfd = Mat_Create(matfile.c_str(), nullptr);
if (matfd == NULL) if (matfd == nullptr)
{ {
fprintf(stderr, "Couldn't open %s for writing.\n", matfile.c_str()); fprintf(stderr, "Couldn't open %s for writing.\n", matfile.c_str());
exit(1); exit(1);

View File

@ -16,7 +16,7 @@ protected:
int n{0}; int n{0};
int depth{0}; int depth{0};
public: public:
KronVector() : Vector((double *) 0, 0) KronVector() : Vector((double *) nullptr, 0)
{ {
} }
KronVector(int mm, int nn, int dp); // new instance KronVector(int mm, int nn, int dp); // new instance

View File

@ -87,7 +87,7 @@ Diagonal::Diagonal(double *data, int d_size)
else else
{ {
// it is last column or we have zero below diagonal // it is last column or we have zero below diagonal
DiagonalBlock b(jbar, true, &data[id], &data[id], NULL, NULL); DiagonalBlock b(jbar, true, &data[id], &data[id], nullptr, nullptr);
blocks.push_back(b); blocks.push_back(b);
} }
jbar++; jbar++;
@ -102,8 +102,8 @@ Diagonal::Diagonal(double *data, const Diagonal &d)
int d_size = d.getSize(); int d_size = d.getSize();
for (const auto & dit : d) for (const auto & dit : d)
{ {
double *beta1 = NULL; double *beta1 = nullptr;
double *beta2 = NULL; double *beta2 = nullptr;
int id = dit.getIndex()*(d_size+1); int id = dit.getIndex()*(d_size+1);
int idd = id; int idd = id;
if (!dit.isReal()) if (!dit.isReal())
@ -157,7 +157,7 @@ Diagonal::changeBase(double *p)
if (b.isReal()) if (b.isReal())
{ {
DiagonalBlock bnew(jbar, true, &p[base], &p[base], DiagonalBlock bnew(jbar, true, &p[base], &p[base],
NULL, NULL); nullptr, nullptr);
it = bnew; it = bnew;
} }
else else
@ -243,8 +243,8 @@ Diagonal::checkConsistency(diag_iter it)
double *d2 = (*it).alpha.a2; double *d2 = (*it).alpha.a2;
(*it).alpha.a2 = (*it).alpha.a1; (*it).alpha.a2 = (*it).alpha.a1;
(*it).real = true; (*it).real = true;
(*it).beta1 = 0; (*it).beta1 = nullptr;
(*it).beta2 = 0; (*it).beta2 = nullptr;
DiagonalBlock b(jbar+1, d2); DiagonalBlock b(jbar+1, d2);
blocks.insert((++it).iter(), b); blocks.insert((++it).iter(), b);
num_real += 2; num_real += 2;

View File

@ -96,8 +96,8 @@ public:
{ {
jbar = jb; jbar = jb;
real = true; real = true;
beta1 = 0; beta1 = nullptr;
beta2 = 0; beta2 = nullptr;
} }
DiagonalBlock(const DiagonalBlock &b) DiagonalBlock(const DiagonalBlock &b)
{ {

View File

@ -18,9 +18,9 @@ SchurDecomp::SchurDecomp(const SqSylvMatrix &m)
lapack_int lwork = 6*rows; lapack_int lwork = 6*rows;
auto *const work = new double[lwork]; auto *const work = new double[lwork];
lapack_int info; lapack_int info;
dgees("V", "N", 0, &rows, auxt.base(), &rows, &sdim, dgees("V", "N", nullptr, &rows, auxt.base(), &rows, &sdim,
wr, wi, q->base(), &rows, wr, wi, q->base(), &rows,
work, &lwork, 0, &info); work, &lwork, nullptr, &info);
delete [] work; delete [] work;
delete [] wi; delete [] wi;
delete [] wr; delete [] wr;

View File

@ -16,7 +16,7 @@ SylvException::SylvException(const char *f, int l, const SylvException *s)
SylvException::~SylvException() SylvException::~SylvException()
{ {
if (source != NULL) if (source != nullptr)
{ {
delete source; delete source;
} }
@ -35,7 +35,7 @@ int
SylvException::printMessage(char *str, int maxlen) const SylvException::printMessage(char *str, int maxlen) const
{ {
int remain = maxlen; int remain = maxlen;
if (source != NULL) if (source != nullptr)
{ {
remain = source->printMessage(str, maxlen); remain = source->printMessage(str, maxlen);
} }
@ -53,7 +53,7 @@ SylvException::printMessage(char *str, int maxlen) const
SylvExceptionMessage::SylvExceptionMessage(const char *f, int i, SylvExceptionMessage::SylvExceptionMessage(const char *f, int i,
const char *mes) const char *mes)
: SylvException(f, i, NULL) : SylvException(f, i, nullptr)
{ {
strcpy(message, mes); strcpy(message, mes);
} }

View File

@ -29,7 +29,7 @@ void operator delete[](void *p);
class SylvMemoryPool class SylvMemoryPool
{ {
char *base{0}; char *base{nullptr};
size_t length{0}; size_t length{0};
size_t allocated{0}; size_t allocated{0};
bool stack_mode{false}; bool stack_mode{false};

View File

@ -19,7 +19,7 @@ class Vector
protected: protected:
int len{0}; int len{0};
int s{1}; int s{1};
double *data{0}; double *data{nullptr};
bool destroy{false}; bool destroy{false};
public: public:
Vector() Vector()

View File

@ -10,7 +10,7 @@
MMMatrixIn::MMMatrixIn(const char *fname) MMMatrixIn::MMMatrixIn(const char *fname)
{ {
FILE *fd; FILE *fd;
if (NULL == (fd = fopen(fname, "r"))) if (nullptr == (fd = fopen(fname, "r")))
throw MMException(string("Cannot open file ")+fname+" for reading\n"); throw MMException(string("Cannot open file ")+fname+" for reading\n");
char buffer[1000]; char buffer[1000];
@ -51,7 +51,7 @@ void
MMMatrixOut::write(const char *fname, int rows, int cols, const double *data) MMMatrixOut::write(const char *fname, int rows, int cols, const double *data)
{ {
FILE *fd; FILE *fd;
if (NULL == (fd = fopen(fname, "w"))) if (nullptr == (fd = fopen(fname, "w")))
throw MMException(string("Cannot open file ")+fname+" for writing\n"); throw MMException(string("Cannot open file ")+fname+" for writing\n");
if (0 > fprintf(fd, "%%%%MatrixMarket matrix array real general\n")) if (0 > fprintf(fd, "%%%%MatrixMarket matrix array real general\n"))

View File

@ -106,7 +106,7 @@ KronProdAll::setMat(int i, const TwoDMatrix &m)
void void
KronProdAll::setUnit(int i, int n) KronProdAll::setUnit(int i, int n)
{ {
matlist[i] = NULL; matlist[i] = nullptr;
kpd.setRC(i, n, n); kpd.setRC(i, n, n);
} }
@ -114,7 +114,7 @@ bool
KronProdAll::isUnit() const KronProdAll::isUnit() const
{ {
int i = 0; int i = 0;
while (i < dimen() && matlist[i] == NULL) while (i < dimen() && matlist[i] == nullptr)
i++; i++;
return i == dimen(); return i == dimen();
} }
@ -279,7 +279,7 @@ KronProdAll::mult(const ConstTwoDMatrix &in, TwoDMatrix &out) const
} }
int c; int c;
TwoDMatrix *last = NULL; TwoDMatrix *last = nullptr;
// perform first multiplication AI // perform first multiplication AI
/* Here we have to construct $A_1\otimes I$, allocate intermediate /* Here we have to construct $A_1\otimes I$, allocate intermediate
@ -338,7 +338,7 @@ KronProdAll::multRows(const IntSequence &irows) const
TL_RAISE_IF(irows.size() != dimen(), TL_RAISE_IF(irows.size() != dimen(),
"Wrong length of row indices in KronProdAll::multRows"); "Wrong length of row indices in KronProdAll::multRows");
Vector *last = NULL; Vector *last = nullptr;
ConstVector *row; ConstVector *row;
vector<Vector *> to_delete; vector<Vector *> to_delete;
for (int i = 0; i < dimen(); i++) for (int i = 0; i < dimen(); i++)

View File

@ -80,7 +80,7 @@ PermutationSet::PermutationSet(const PermutationSet &sp, int n)
pers(new const Permutation *[size]) pers(new const Permutation *[size])
{ {
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
pers[i] = NULL; pers[i] = nullptr;
TL_RAISE_IF(n != sp.order+1, TL_RAISE_IF(n != sp.order+1,
"Wrong new order in PermutationSet constructor"); "Wrong new order in PermutationSet constructor");

View File

@ -22,7 +22,7 @@ namespace sthread
void void
thread_traits<posix>::run(_Ctype *c) thread_traits<posix>::run(_Ctype *c)
{ {
pthread_create(&(c->getThreadIden()), NULL, posix_thread_function, (void *) c); pthread_create(&(c->getThreadIden()), nullptr, posix_thread_function, (void *) c);
} }
void *posix_detach_thread_function(void *c); void *posix_detach_thread_function(void *c);
@ -42,21 +42,21 @@ namespace sthread
void void
thread_traits<posix>::exit() thread_traits<posix>::exit()
{ {
pthread_exit(NULL); pthread_exit(nullptr);
} }
template <> template <>
void void
thread_traits<posix>::join(_Ctype *c) thread_traits<posix>::join(_Ctype *c)
{ {
pthread_join(c->getThreadIden(), NULL); pthread_join(c->getThreadIden(), nullptr);
} }
template <> template <>
void void
mutex_traits<posix>::init(pthread_mutex_t &m) mutex_traits<posix>::init(pthread_mutex_t &m)
{ {
pthread_mutex_init(&m, NULL); pthread_mutex_init(&m, nullptr);
} }
template <> template <>
@ -77,7 +77,7 @@ namespace sthread
void void
cond_traits<posix>::init(_Tcond &cond) cond_traits<posix>::init(_Tcond &cond)
{ {
pthread_cond_init(&cond, NULL); pthread_cond_init(&cond, nullptr);
} }
template <> template <>
@ -127,7 +127,7 @@ namespace sthread
{ {
ct->exit(); ct->exit();
} }
return NULL; return nullptr;
} }
void * void *
@ -146,7 +146,7 @@ namespace sthread
} }
if (counter) if (counter)
counter->decrease(); counter->decrease();
return NULL; return nullptr;
} }
} }
#else #else

View File

@ -302,7 +302,7 @@ namespace sthread
{ {
auto it = _Tparent::find(mmkey(c, id)); auto it = _Tparent::find(mmkey(c, id));
if (it == _Tparent::end()) if (it == _Tparent::end())
return NULL; return nullptr;
return &((*it).second); return &((*it).second);
} }
@ -502,7 +502,7 @@ namespace sthread
{ {
public: public:
condition_counter<thread_impl> *counter; condition_counter<thread_impl> *counter;
detach_thread() : counter(NULL) detach_thread() : counter(nullptr)
{ {
} }
void void

View File

@ -57,7 +57,7 @@ Symmetry::isFull() const
beginning as subordinal |symiterator|. */ beginning as subordinal |symiterator|. */
symiterator::symiterator(SymmetrySet &ss) symiterator::symiterator(SymmetrySet &ss)
: s(ss), subit(NULL), subs(NULL), end_flag(false) : s(ss), subit(nullptr), subs(nullptr), end_flag(false)
{ {
s.sym()[0] = 0; s.sym()[0] = 0;
if (s.size() == 2) if (s.size() == 2)

View File

@ -144,7 +144,7 @@ public:
if (it == m.end()) if (it == m.end())
{ {
TL_RAISE("Symmetry not found in TensorContainer::get"); TL_RAISE("Symmetry not found in TensorContainer::get");
return NULL; return nullptr;
} }
else else
{ {
@ -161,7 +161,7 @@ public:
if (it == m.end()) if (it == m.end())
{ {
TL_RAISE("Symmetry not found in TensorContainer::get"); TL_RAISE("Symmetry not found in TensorContainer::get");
return NULL; return nullptr;
} }
else else
{ {

View File

@ -65,7 +65,7 @@ class PowerProvider
int nv; int nv;
public: public:
PowerProvider(const ConstVector &v) PowerProvider(const ConstVector &v)
: origv(v), ut(NULL), ft(NULL), nv(v.length()) : origv(v), ut(nullptr), ft(nullptr), nv(v.length())
{ {
} }
~PowerProvider(); ~PowerProvider();
@ -165,7 +165,7 @@ public:
PowerProvider pwp(xval); PowerProvider pwp(xval);
for (int i = 1; i <= tp.maxdim; i++) for (int i = 1; i <= tp.maxdim; i++)
{ {
const _Stype &xpow = pwp.getNext((const _Stype *) NULL); const _Stype &xpow = pwp.getNext((const _Stype *) nullptr);
for (int j = 0; j <= tp.maxdim-i; j++) for (int j = 0; j <= tp.maxdim-i; j++)
{ {
if (tp.check(Symmetry(i+j))) if (tp.check(Symmetry(i+j)))
@ -255,7 +255,7 @@ public:
PowerProvider pp(v); PowerProvider pp(v);
for (int d = 1; d <= maxdim; d++) for (int d = 1; d <= maxdim; d++)
{ {
const _Stype &p = pp.getNext((const _Stype *) NULL); const _Stype &p = pp.getNext((const _Stype *) nullptr);
Symmetry cs(d); Symmetry cs(d);
if (_Tparent::check(cs)) if (_Tparent::check(cs))
{ {

View File

@ -10,9 +10,9 @@ TLStatic tls;
TLStatic::TLStatic() TLStatic::TLStatic()
{ {
ebundle = NULL; ebundle = nullptr;
pbundle = NULL; pbundle = nullptr;
ptriang = NULL; ptriang = nullptr;
} }
TLStatic::~TLStatic() TLStatic::~TLStatic()

View File

@ -104,7 +104,7 @@ void
TwoDMatrix::save(const char *fname) const TwoDMatrix::save(const char *fname) const
{ {
FILE *fd; FILE *fd;
if (NULL == (fd = fopen(fname, "w"))) if (nullptr == (fd = fopen(fname, "w")))
{ {
TL_RAISE("Cannot open file for writing in TwoDMatrix::save"); TL_RAISE("Cannot open file for writing in TwoDMatrix::save");
} }

View File

@ -505,11 +505,11 @@ DenseDerivGenerator::DenseDerivGenerator(int ng, int nx, int ny, int nu,
Monom2Vector r(g, x); Monom2Vector r(g, x);
xcont = x.deriv(maxdimen); xcont = x.deriv(maxdimen);
rcont = r.deriv(maxdimen); rcont = r.deriv(maxdimen);
uxcont = NULL; uxcont = nullptr;
for (int d = 1; d <= maxdimen; d++) for (int d = 1; d <= maxdimen; d++)
{ {
ts[d-1] = g.deriv(d); ts[d-1] = g.deriv(d);
uts[d-1] = NULL; uts[d-1] = nullptr;
} }
} }

View File

@ -49,7 +49,7 @@ ogu::calc_pos_line_and_col(int length, const char *str, int offset,
} }
MemoryFile::MemoryFile(const char *fname) MemoryFile::MemoryFile(const char *fname)
: len(-1), data(NULL) : len(-1), data(nullptr)
{ {
FILE *fd = fopen(fname, "rb"); FILE *fd = fopen(fname, "rb");
if (fd) if (fd)