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

@@ -330,7 +330,7 @@
else {
while (g29_repetition_cnt--) {
if (cnt > 20) { cnt = 0; idle(); }
const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, g29_x_pos, g29_y_pos, USE_NOZZLE_AS_REFERENCE, NULL);
const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, g29_x_pos, g29_y_pos, USE_NOZZLE_AS_REFERENCE, nullptr);
if (location.x_index < 0) {
// No more REACHABLE mesh points to invalidate, so we ASSUME the user
// meant to invalidate the ENTIRE mesh, which cannot be done with
@@ -528,7 +528,7 @@
}
else {
while (g29_repetition_cnt--) { // this only populates reachable mesh points near
const mesh_index_pair location = find_closest_mesh_point_of_type(INVALID, g29_x_pos, g29_y_pos, USE_NOZZLE_AS_REFERENCE, NULL);
const mesh_index_pair location = find_closest_mesh_point_of_type(INVALID, g29_x_pos, g29_y_pos, USE_NOZZLE_AS_REFERENCE, nullptr);
if (location.x_index < 0) {
// No more REACHABLE INVALID mesh points to populate, so we ASSUME
// user meant to populate ALL INVALID mesh points to value
@@ -759,7 +759,7 @@
if (do_furthest)
location = find_furthest_invalid_mesh_point();
else
location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_PROBE_AS_REFERENCE, NULL);
location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_PROBE_AS_REFERENCE, nullptr);
if (location.x_index >= 0) { // mesh point found and is reachable by probe
const float rawx = mesh_index_to_xpos(location.x_index),
@@ -793,7 +793,7 @@
typedef void (*clickFunc_t)();
bool click_and_hold(const clickFunc_t func=NULL) {
bool click_and_hold(const clickFunc_t func=nullptr) {
if (ui.button_pressed()) {
ui.quick_feedback(false); // Preserve button state for click-and-hold
const millis_t nxt = millis() + 1500UL;
@@ -891,7 +891,7 @@
mesh_index_pair location;
do {
location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_NOZZLE_AS_REFERENCE, NULL);
location = find_closest_mesh_point_of_type(INVALID, rx, ry, USE_NOZZLE_AS_REFERENCE, nullptr);
// It doesn't matter if the probe can't reach the NAN location. This is a manual probe.
if (location.x_index < 0 && location.y_index < 0) continue;

View File

@@ -84,7 +84,7 @@ void host_action(const char * const pstr, const bool eol) {
void host_action_prompt_button(const char * const pstr) { host_action_prompt_plus(PSTR("button"), pstr); }
void host_action_prompt_end() { host_action_prompt(PSTR("end")); }
void host_action_prompt_show() { host_action_prompt(PSTR("show")); }
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const pbtn/*=NULL*/) {
void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const pbtn/*=nullptr*/) {
host_prompt_reason = reason;
host_action_prompt_end();
host_action_prompt_begin(pstr);

View File

@@ -64,8 +64,8 @@ void host_action(const char * const pstr, const bool eol=true);
void host_action_prompt_button(const char * const pstr);
void host_action_prompt_end();
void host_action_prompt_show();
void host_prompt_do(const PromptReason type, const char * const pstr, const char * const pbtn=NULL);
inline void host_prompt_open(const PromptReason reason, const char * const pstr, const char * const pbtn=NULL) {
void host_prompt_do(const PromptReason type, const char * const pstr, const char * const pbtn=nullptr);
inline void host_prompt_open(const PromptReason reason, const char * const pstr, const char * const pbtn=nullptr) {
if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, pbtn);
}

View File

@@ -162,7 +162,7 @@ void TWIBus::flush() {
echodata(bytes, PSTR("i2c-receive"), 0);
}
void TWIBus::reply(char str[]/*=NULL*/) {
void TWIBus::reply(char str[]/*=nullptr*/) {
#if ENABLED(DEBUG_TWIBUS)
debug(PSTR("reply"), str);
#endif

View File

@@ -217,7 +217,7 @@ class TWIBus {
* @details Send the buffer and clear it.
* If a string is passed, write it into the buffer first.
*/
void reply(char str[]=NULL);
void reply(char str[]=nullptr);
inline void reply(const char str[]) { this->reply((char*)str); }
#endif