Use C++ language supported 'nullptr' (#13944)

This commit is contained in:
Scott Lahteine
2019-05-09 11:45:55 -05:00
committed by GitHub
parent e53d7e5517
commit ad4ffa1d2f
70 changed files with 670 additions and 668 deletions

View File

@ -2132,7 +2132,7 @@ void MarlinSettings::postprocess() {
#endif
}
void MarlinSettings::load_mesh(const int8_t slot, void * const into/*=NULL*/) {
void MarlinSettings::load_mesh(const int8_t slot, void * const into/*=nullptr*/) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
@ -2545,7 +2545,7 @@ void MarlinSettings::reset() {
#if HAS_TRINAMIC
inline void say_M906(const bool forReplay) { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" M906"); }
#if HAS_STEALTHCHOP
void say_M569(const char * const etc=NULL) {
void say_M569(const char * const etc=nullptr) {
SERIAL_ECHOPGM(" M569 S1");
if (etc) {
SERIAL_CHAR(' ');

View File

@ -65,7 +65,7 @@ class MarlinSettings {
static uint16_t calc_num_meshes();
static int mesh_slot_offset(const int8_t slot);
static void store_mesh(const int8_t slot);
static void load_mesh(const int8_t slot, void * const into=NULL);
static void load_mesh(const int8_t slot, void * const into=nullptr);
//static void delete_mesh(); // necessary if we have a MAT
//static void defrag_meshes(); // "

View File

@ -377,7 +377,7 @@ void Endstops::event_handler() {
prev_hit_state = hit_state;
}
static void print_es_state(const bool is_hit, PGM_P const label=NULL) {
static void print_es_state(const bool is_hit, PGM_P const label=nullptr) {
if (label) serialprintPGM(label);
SERIAL_ECHOPGM(": ");
serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN));

View File

@ -900,7 +900,7 @@ void Planner::reverse_pass() {
// Reverse Pass: Coarsely maximize all possible deceleration curves back-planning from the last
// block in buffer. Cease planning when the last optimal planned or tail pointer is reached.
// NOTE: Forward pass will later refine and correct the reverse pass to create an optimal plan.
const block_t *next = NULL;
const block_t *next = nullptr;
while (block_index != planned_block_index) {
// Perform the reverse pass
@ -995,7 +995,7 @@ void Planner::forward_pass() {
uint8_t block_index = block_buffer_planned;
block_t *current;
const block_t * previous = NULL;
const block_t * previous = nullptr;
while (block_index != block_buffer_head) {
// Perform the forward pass
@ -1045,7 +1045,7 @@ void Planner::recalculate_trapezoids() {
}
// Go from the tail (currently executed block) to the first block, without including it)
block_t *current = NULL, *next = NULL;
block_t *current = nullptr, *next = nullptr;
float current_entry_speed = 0.0, next_entry_speed = 0.0;
while (block_index != head_block_index) {

View File

@ -746,7 +746,7 @@ class Planner {
FORCE_INLINE static bool has_blocks_queued() { return (block_buffer_head != block_buffer_tail); }
/**
* The current block. NULL if the buffer is empty.
* The current block. nullptr if the buffer is empty.
* This also marks the block as busy.
* WARNING: Called from Stepper ISR context!
*/
@ -763,7 +763,7 @@ class Planner {
--delay_before_delivering;
// If the number of movements queued is less than 3, and there is still time
// to wait, do not deliver anything
if (nr_moves < 3 && delay_before_delivering) return NULL;
if (nr_moves < 3 && delay_before_delivering) return nullptr;
delay_before_delivering = 0;
}
@ -771,7 +771,7 @@ class Planner {
block_t * const block = &block_buffer[block_buffer_tail];
// No trapezoid calculated? Don't execute yet.
if (TEST(block->flag, BLOCK_BIT_RECALCULATE)) return NULL;
if (TEST(block->flag, BLOCK_BIT_RECALCULATE)) return nullptr;
#if ENABLED(ULTRA_LCD)
block_buffer_runtime_us -= block->segment_time_us; // We can't be sure how long an active block will take, so don't count it.
@ -793,7 +793,7 @@ class Planner {
clear_block_buffer_runtime(); // paranoia. Buffer is empty now - so reset accumulated time to zero.
#endif
return NULL;
return nullptr;
}
/**

View File

@ -133,7 +133,7 @@ Stepper stepper; // Singleton
// private:
block_t* Stepper::current_block; // (= NULL) A pointer to the block currently being traced
block_t* Stepper::current_block; // (= nullptr) A pointer to the block currently being traced
uint8_t Stepper::last_direction_bits, // = 0
Stepper::axis_did_move; // = 0
@ -1394,7 +1394,7 @@ void Stepper::stepper_pulse_phase_isr() {
abort_current_block = false;
if (current_block) {
axis_did_move = 0;
current_block = NULL;
current_block = nullptr;
planner.discard_current_block();
}
}
@ -1541,7 +1541,7 @@ uint32_t Stepper::stepper_block_phase_isr() {
runout.block_completed(current_block);
#endif
axis_did_move = 0;
current_block = NULL;
current_block = nullptr;
planner.discard_current_block();
}
else {

View File

@ -1264,7 +1264,7 @@ void Temperature::manage_heater() {
#if ENABLED(CHAMBER_USER_THERMISTOR)
t_index == CTI_CHAMBER ? PSTR("CHAMBER") :
#endif
NULL
nullptr
);
SERIAL_EOL();
}

View File

@ -147,7 +147,7 @@
#elif defined(HEATER_0_USES_THERMISTOR)
#error "No heater 0 thermistor table specified"
#else
#define HEATER_0_TEMPTABLE NULL
#define HEATER_0_TEMPTABLE nullptr
#define HEATER_0_TEMPTABLE_LEN 0
#endif
@ -157,7 +157,7 @@
#elif defined(HEATER_1_USES_THERMISTOR)
#error "No heater 1 thermistor table specified"
#else
#define HEATER_1_TEMPTABLE NULL
#define HEATER_1_TEMPTABLE nullptr
#define HEATER_1_TEMPTABLE_LEN 0
#endif
@ -167,7 +167,7 @@
#elif defined(HEATER_2_USES_THERMISTOR)
#error "No heater 2 thermistor table specified"
#else
#define HEATER_2_TEMPTABLE NULL
#define HEATER_2_TEMPTABLE nullptr
#define HEATER_2_TEMPTABLE_LEN 0
#endif
@ -177,7 +177,7 @@
#elif defined(HEATER_3_USES_THERMISTOR)
#error "No heater 3 thermistor table specified"
#else
#define HEATER_3_TEMPTABLE NULL
#define HEATER_3_TEMPTABLE nullptr
#define HEATER_3_TEMPTABLE_LEN 0
#endif
@ -187,7 +187,7 @@
#elif defined(HEATER_4_USES_THERMISTOR)
#error "No heater 4 thermistor table specified"
#else
#define HEATER_4_TEMPTABLE NULL
#define HEATER_4_TEMPTABLE nullptr
#define HEATER_4_TEMPTABLE_LEN 0
#endif
@ -197,7 +197,7 @@
#elif defined(HEATER_5_USES_THERMISTOR)
#error "No heater 5 thermistor table specified"
#else
#define HEATER_5_TEMPTABLE NULL
#define HEATER_5_TEMPTABLE nullptr
#define HEATER_5_TEMPTABLE_LEN 0
#endif