Skip to content

Commit

Permalink
Merge pull request #2886 from moorewf/development
Browse files Browse the repository at this point in the history
Use clang-tidy to use nullptr instead of 0 or NULL in e directory.
  • Loading branch information
DanGrayson authored Aug 12, 2023
2 parents 7226b7c + d4aeb8a commit 0cd5760
Show file tree
Hide file tree
Showing 145 changed files with 2,343 additions and 2,331 deletions.
26 changes: 13 additions & 13 deletions M2/Macaulay2/e/Eschreyer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ GBMatrix *GBKernelComputation::get_syzygies()
for (int i = 0; i < syzygies.size(); i++)
{
result->append(syzygies[i]);
syzygies[i] = 0;
syzygies[i] = nullptr;
}
return result;
}
Expand Down Expand Up @@ -132,20 +132,20 @@ void GBKernelComputation::strip_gb(const GBMatrix *m)
int i;
int *components = newarray_atomic_clear(int, F->rank());
for (i = 0; i < g.size(); i++)
if (g[i] != 0) components[g[i]->comp - 1]++;
if (g[i] != nullptr) components[g[i]->comp - 1]++;

for (i = 0; i < g.size(); i++)
{
gbvector head;
gbvector *last = &head;
for (gbvector *v = g[i]; v != 0; v = v->next)
for (gbvector *v = g[i]; v != nullptr; v = v->next)
if (components[v->comp - 1] > 0)
{
gbvector *t = GR->gbvector_copy_term(v);
last->next = t;
last = t;
}
last->next = 0;
last->next = nullptr;
gb.push_back(head.next);
}
for (i = 0; i < F->rank(); i++) mi.push_back(new MonomialIdeal(R));
Expand Down Expand Up @@ -182,7 +182,7 @@ void GBKernelComputation::new_pairs(int i)
{
thisvp.resize(0);
varpower::var(w, 1, thisvp);
Bag *b = new Bag(static_cast<void *>(0), thisvp);
Bag *b = new Bag(static_cast<void *>(nullptr), thisvp);
elems.push_back(b);
}

Expand All @@ -203,7 +203,7 @@ void GBKernelComputation::new_pairs(int i)
varpower::quotient(a.monom().data(), vp.data(), thisvp);
if (varpower::is_equal(a.monom().data(), thisvp.data()))
continue;
Bag *b = new Bag(static_cast<void *>(0), thisvp);
Bag *b = new Bag(static_cast<void *>(nullptr), thisvp);
elems.push_back(b);
}
}
Expand Down Expand Up @@ -297,9 +297,9 @@ int GBKernelComputation::find_divisor(const MonomialIdeal *this_mi,

gbvector *GBKernelComputation::s_pair(gbvector *gsyz)
{
gbvector *result = NULL;
gbvector *result = nullptr;
monomial si = M->make_one();
for (gbvector *f = gsyz; f != 0; f = f->next)
for (gbvector *f = gsyz; f != nullptr; f = f->next)
{
SG->schreyer_down(f->monom, f->comp - 1, si);
gbvector *h = GR->mult_by_term(F, gb[f->comp - 1], f->coeff, si, 0);
Expand All @@ -318,7 +318,7 @@ void GBKernelComputation::wipe_unneeded_terms(gbvector *&f)
// int nterms = 1;
// int nsaved = 0;
gbvector *g = f;
while (g->next != 0)
while (g->next != nullptr)
{
// First check to see if the term g->next is in the monideal
// nterms++;
Expand All @@ -335,7 +335,7 @@ void GBKernelComputation::wipe_unneeded_terms(gbvector *&f)
// nsaved++;
gbvector *tmp = g->next;
g->next = tmp->next;
tmp->next = 0;
tmp->next = nullptr;
GR->gbvector_remove(tmp);
}
}
Expand Down Expand Up @@ -367,7 +367,7 @@ void GBKernelComputation::reduce(gbvector *&f, gbvector *&fsyz)
int count = 0;
if (M2_gbTrace >= 4) emit_wrapped(",");

while (f != NULL)
while (f != nullptr)
{
if (SF)
{
Expand Down Expand Up @@ -452,14 +452,14 @@ void GBKernelComputation::geo_reduce(gbvector *&f, gbvector *&fsyz)
const gbvector *r;
gbvectorHeap fb(GR, F);
fb.add(f);
f = NULL;
f = nullptr;
const gbvector *lead;
int q;

int count = 0;
if (M2_gbTrace >= 4) emit_wrapped(",");

while ((lead = fb.get_lead_term()) != NULL)
while ((lead = fb.get_lead_term()) != nullptr)
{
if (SF)
{
Expand Down
2 changes: 1 addition & 1 deletion M2/Macaulay2/e/GF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ GF::~GF() {}
GF *GF::create(const RingElement *prim)
{
GF *result = new GF;
if (!result->initialize_GF(prim)) return 0;
if (!result->initialize_GF(prim)) return nullptr;

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion M2/Macaulay2/e/LLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bool LLLoperations::initializeLLL(const MutableMatrix *A,
MutableMatrix *&LLLstate)
{
// First check m: should be a matrix over globalZZ.
if (A == 0 || A->get_ring() != globalZZ)
if (A == nullptr || A->get_ring() != globalZZ)
{
ERROR("LLL only defined for matrices over ZZ");
return false;
Expand Down
Loading

0 comments on commit 0cd5760

Please sign in to comment.