clang-tidy modernize-use-nullptr

This commit is contained in:
Daniel Agar
2017-02-01 22:15:50 -05:00
parent ec2467d4a5
commit e927f3e040
48 changed files with 155 additions and 153 deletions
+9 -9
View File
@@ -57,14 +57,14 @@ Block::Block(SuperBlock *parent, const char *name) :
_subscriptions(),
_params()
{
if (getParent() != NULL) {
if (getParent() != nullptr) {
getParent()->getChildren().add(this);
}
}
void Block::getName(char *buf, size_t n)
{
if (getParent() == NULL) {
if (getParent() == nullptr) {
strncpy(buf, _name, n);
// ensure string is terminated
buf[n - 1] = '\0';
@@ -89,7 +89,7 @@ void Block::updateParams()
BlockParamBase *param = getParams().getHead();
int count = 0;
while (param != NULL) {
while (param != nullptr) {
if (count++ > maxParamsPerBlock) {
char name[blockNameLengthMax];
getName(name, blockNameLengthMax);
@@ -108,7 +108,7 @@ void Block::updateSubscriptions()
uORB::SubscriptionNode *sub = getSubscriptions().getHead();
int count = 0;
while (sub != NULL) {
while (sub != nullptr) {
if (count++ > maxSubscriptionsPerBlock) {
char name[blockNameLengthMax];
getName(name, blockNameLengthMax);
@@ -126,7 +126,7 @@ void Block::updatePublications()
uORB::PublicationNode *pub = getPublications().getHead();
int count = 0;
while (pub != NULL) {
while (pub != nullptr) {
if (count++ > maxPublicationsPerBlock) {
char name[blockNameLengthMax];
getName(name, blockNameLengthMax);
@@ -145,7 +145,7 @@ void SuperBlock::setDt(float dt)
Block *child = getChildren().getHead();
int count = 0;
while (child != NULL) {
while (child != nullptr) {
if (count++ > maxChildrenPerBlock) {
char name[blockNameLengthMax];
getName(name, blockNameLengthMax);
@@ -163,7 +163,7 @@ void SuperBlock::updateChildParams()
Block *child = getChildren().getHead();
int count = 0;
while (child != NULL) {
while (child != nullptr) {
if (count++ > maxChildrenPerBlock) {
char name[blockNameLengthMax];
getName(name, blockNameLengthMax);
@@ -181,7 +181,7 @@ void SuperBlock::updateChildSubscriptions()
Block *child = getChildren().getHead();
int count = 0;
while (child != NULL) {
while (child != nullptr) {
if (count++ > maxChildrenPerBlock) {
char name[blockNameLengthMax];
getName(name, blockNameLengthMax);
@@ -199,7 +199,7 @@ void SuperBlock::updateChildPublications()
Block *child = getChildren().getHead();
int count = 0;
while (child != NULL) {
while (child != nullptr) {
if (count++ > maxChildrenPerBlock) {
char name[blockNameLengthMax];
getName(name, blockNameLengthMax);
+1 -1
View File
@@ -53,7 +53,7 @@ BlockParamBase::BlockParamBase(Block *parent, const char *name, bool parent_pref
{
char fullname[blockNameLengthMax];
if (parent == NULL) {
if (parent == nullptr) {
strncpy(fullname, name, blockNameLengthMax);
} else {
+1 -1
View File
@@ -45,7 +45,7 @@ namespace launchdetection
{
LaunchDetector::LaunchDetector() :
SuperBlock(NULL, "LAUN"),
SuperBlock(nullptr, "LAUN"),
activeLaunchDetectionMethodIndex(-1),
launchdetection_on(this, "ALL_ON"),
throttlePreTakeoff(nullptr, "FW_THR_IDLE")
+1 -1
View File
@@ -52,7 +52,7 @@ namespace runwaytakeoff
{
RunwayTakeoff::RunwayTakeoff() :
SuperBlock(NULL, "RWTO"),
SuperBlock(nullptr, "RWTO"),
_state(),
_initialized(false),
_initialized_time(0),