mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 07:43:35 +08:00
clang-tidy modernize-use-nullptr
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace runwaytakeoff
|
||||
{
|
||||
|
||||
RunwayTakeoff::RunwayTakeoff() :
|
||||
SuperBlock(NULL, "RWTO"),
|
||||
SuperBlock(nullptr, "RWTO"),
|
||||
_state(),
|
||||
_initialized(false),
|
||||
_initialized_time(0),
|
||||
|
||||
Reference in New Issue
Block a user