Merge: Codechange: Use null pointer literal instead of the NULL macro

This commit is contained in:
Jonathan G Rennison
2019-04-11 18:14:13 +01:00
585 changed files with 6604 additions and 6604 deletions

View File

@@ -121,7 +121,7 @@ public:
* @param job Job to iterate on.
*/
GraphEdgeIterator(LinkGraphJob &job) : job(job),
i(NULL, NULL, INVALID_NODE), end(NULL, NULL, INVALID_NODE)
i(nullptr, nullptr, INVALID_NODE), end(nullptr, nullptr, INVALID_NODE)
{}
/**
@@ -273,7 +273,7 @@ struct AnnoSetAllocatorStore {
size_t next_position;
void *last_freed;
AnnoSetAllocatorStore() : current_block(NULL), next_position(0), last_freed(NULL) {}
AnnoSetAllocatorStore() : current_block(nullptr), next_position(0), last_freed(nullptr) {}
~AnnoSetAllocatorStore()
{
@@ -316,12 +316,12 @@ struct AnnoSetAllocator {
Ttype* allocate(size_t n)
{
if (store.current_block == NULL) NewBlock();
if (store.current_block == nullptr) NewBlock();
assert(n == 1);
if (store.last_freed != NULL) {
if (store.last_freed != nullptr) {
Ttype* out = static_cast<Ttype*>(store.last_freed);
store.last_freed = NULL;
store.last_freed = nullptr;
return out;
}
@@ -377,7 +377,7 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
#endif
Tedge_iterator iter(this->job);
uint size = this->job.Size();
paths.resize(size, NULL);
paths.resize(size, nullptr);
this->job.path_allocator.SetParameters(sizeof(AnnosWrapper<Tannotation>), (8192 - 32) / sizeof(AnnosWrapper<Tannotation>));
@@ -424,16 +424,16 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
void MultiCommodityFlow::CleanupPaths(NodeID source_id, PathVector &paths)
{
Path *source = paths[source_id];
paths[source_id] = NULL;
paths[source_id] = nullptr;
for (PathVector::iterator i = paths.begin(); i != paths.end(); ++i) {
Path *path = *i;
if (path == NULL) continue;
if (path == nullptr) continue;
if (path->GetParent() == source) path->Detach();
while (path != source && path != NULL && path->GetFlow() == 0) {
while (path != source && path != nullptr && path->GetFlow() == 0) {
Path *parent = path->GetParent();
path->Detach();
if (path->GetNumChildren() == 0) {
paths[path->GetNode()] = NULL;
paths[path->GetNode()] = nullptr;
this->job.path_allocator.Free(path);
}
path = parent;
@@ -522,7 +522,7 @@ bool MCF1stPass::EliminateCycles(PathVector &path, NodeID origin_id, NodeID next
/* this node has already been searched */
if (at_next_pos == Path::invalid_path) return false;
if (at_next_pos == NULL) {
if (at_next_pos == nullptr) {
/* Summarize paths; add up the paths with the same source and next hop
* in one path each. */
PathList &paths = this->job[next_id].Paths();
@@ -573,7 +573,7 @@ bool MCF1stPass::EliminateCycles(PathVector &path, NodeID origin_id, NodeID next
* could be found in this branch, thus it has to be searched again next
* time we spot it.
*/
path[next_id] = found ? NULL : Path::invalid_path;
path[next_id] = found ? nullptr : Path::invalid_path;
return found;
}
@@ -597,11 +597,11 @@ bool MCF1stPass::EliminateCycles()
{
bool cycles_found = false;
uint size = this->job.Size();
PathVector path(size, NULL);
PathVector path(size, nullptr);
for (NodeID node = 0; node < size; ++node) {
/* Starting at each node in the graph find all cycles involving this
* node. */
std::fill(path.begin(), path.end(), (Path *)NULL);
std::fill(path.begin(), path.end(), (Path *)nullptr);
cycles_found |= this->EliminateCycles(path, node, node);
}
return cycles_found;
@@ -628,7 +628,7 @@ MCF1stPass::MCF1stPass(LinkGraphJob &job) : MultiCommodityFlow(job)
Edge edge = job[source][dest];
if (edge.UnsatisfiedDemand() > 0) {
Path *path = paths[dest];
assert(path != NULL);
assert(path != nullptr);
/* Generally only allow paths that don't exceed the
* available capacity. But if no demand has been assigned
* yet, make an exception and allow any valid path *once*. */