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
+4 -4
View File
@@ -157,7 +157,7 @@ static constexpr uint8_t COMMANDER_MAX_GPS_NOISE = 60; /**< Maximum percentage
#define HIL_ID_MAX 1999
/* Mavlink log uORB handle */
static orb_advert_t mavlink_log_pub = 0;
static orb_advert_t mavlink_log_pub = nullptr;
/* System autostart ID */
static int autostart_id;
@@ -1714,7 +1714,7 @@ int commander_thread_main(int argc, char *argv[])
(void)pthread_attr_setschedparam(&commander_low_prio_attr, &param);
#endif
pthread_create(&commander_low_prio_thread, &commander_low_prio_attr, commander_low_prio_loop, NULL);
pthread_create(&commander_low_prio_thread, &commander_low_prio_attr, commander_low_prio_loop, nullptr);
pthread_attr_destroy(&commander_low_prio_attr);
while (!thread_should_exit) {
@@ -3075,7 +3075,7 @@ int commander_thread_main(int argc, char *argv[])
}
/* wait for threads to complete */
ret = pthread_join(commander_low_prio_thread, NULL);
ret = pthread_join(commander_low_prio_thread, nullptr);
if (ret) {
warn("join failed: %d", ret);
@@ -4169,5 +4169,5 @@ void *commander_low_prio_loop(void *arg)
px4_close(cmd_sub);
return NULL;
return nullptr;
}
+4 -4
View File
@@ -548,9 +548,9 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub)
worker_data.sub_mag[cur_mag] = -1;
// Initialize to no memory allocated
worker_data.x[cur_mag] = NULL;
worker_data.y[cur_mag] = NULL;
worker_data.z[cur_mag] = NULL;
worker_data.x[cur_mag] = nullptr;
worker_data.y[cur_mag] = nullptr;
worker_data.z[cur_mag] = nullptr;
worker_data.calibration_counter_total[cur_mag] = 0;
}
@@ -563,7 +563,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub)
worker_data.y[cur_mag] = reinterpret_cast<float *>(malloc(sizeof(float) * calibration_points_maxcount));
worker_data.z[cur_mag] = reinterpret_cast<float *>(malloc(sizeof(float) * calibration_points_maxcount));
if (worker_data.x[cur_mag] == NULL || worker_data.y[cur_mag] == NULL || worker_data.z[cur_mag] == NULL) {
if (worker_data.x[cur_mag] == nullptr || worker_data.y[cur_mag] == nullptr || worker_data.z[cur_mag] == nullptr) {
calibration_log_critical(mavlink_log_pub, "[cal] ERROR: out of memory");
result = calibrate_return_error;
}
@@ -564,7 +564,7 @@ transition_result_t hil_state_transition(hil_state_t new_state, orb_advert_t sta
for (;;) {
devname = px4_get_device_names(&handle);
if (devname == NULL) {
if (devname == nullptr) {
break;
}