Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I8505591d6eccd8ee50426ef2462b277d9ea17d69
diff --git a/c2hal/AST.cpp b/c2hal/AST.cpp
index 783a04e..5e7928c 100644
--- a/c2hal/AST.cpp
+++ b/c2hal/AST.cpp
@@ -37,7 +37,7 @@
const std::string &outputDir,
const std::string &package,
bool isOpenGl)
- : mScanner(NULL),
+ : mScanner(nullptr),
mPath(path),
mOutputDir(outputDir),
mPackage(package),
@@ -47,21 +47,21 @@
AST::~AST() {
delete mExpression;
- if(mDeclarations != NULL) {
+ if(mDeclarations != nullptr) {
for(auto* decl : *mDeclarations) {
delete decl;
}
}
delete mDeclarations;
- if(mInterfaces != NULL) {
+ if(mInterfaces != nullptr) {
for(auto* inter : *mInterfaces) {
delete inter;
}
}
delete mInterfaces;
- if(mIncludes != NULL) {
+ if(mIncludes != nullptr) {
for(auto* incl : *mIncludes) {
delete incl;
}
@@ -116,10 +116,10 @@
}
void AST::processContents() {
- CHECK(mDeclarations != NULL);
+ CHECK(mDeclarations != nullptr);
for (auto &declaration : *mDeclarations) {
- CHECK(declaration != NULL);
+ CHECK(declaration != nullptr);
declaration->processContents(*this);
}
@@ -209,7 +209,7 @@
auto var = new EnumVarDeclaration(define->getName(),
define->getExpression());
- define->setExpression(NULL);
+ define->setExpression(nullptr);
constants->push_back(var);
it = mDeclarations->erase(it);
@@ -233,7 +233,7 @@
}
status_t AST::generateCode() const {
- CHECK(mDeclarations != NULL);
+ CHECK(mDeclarations != nullptr);
status_t err;
@@ -259,7 +259,7 @@
FILE *file = fopen((getFileDir() + fileName).c_str(), "w");
- if(file == NULL) {
+ if(file == nullptr) {
return -errno;
}
@@ -280,7 +280,7 @@
FILE *file = fopen((getFileDir() + "types.hal").c_str(), "w");
- if(file == NULL) {
+ if(file == nullptr) {
return -errno;
}