Use C++ language supported 'nullptr' (#13944)
This commit is contained in:
@@ -135,7 +135,7 @@ public:
|
||||
const bool b = TEST32(codebits, ind);
|
||||
if (b) {
|
||||
char * const ptr = command_ptr + param[ind];
|
||||
value_ptr = param[ind] && valid_float(ptr) ? ptr : (char*)NULL;
|
||||
value_ptr = param[ind] && valid_float(ptr) ? ptr : nullptr;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
static inline bool seen(const char c) {
|
||||
char *p = strchr(command_args, c);
|
||||
const bool b = !!p;
|
||||
if (b) value_ptr = valid_float(&p[1]) ? &p[1] : (char*)NULL;
|
||||
if (b) value_ptr = valid_float(&p[1]) ? &p[1] : nullptr;
|
||||
return b;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
#endif
|
||||
|
||||
// The code value pointer was set
|
||||
FORCE_INLINE static bool has_value() { return value_ptr != NULL; }
|
||||
FORCE_INLINE static bool has_value() { return value_ptr != nullptr; }
|
||||
|
||||
// Seen a parameter with a value
|
||||
static inline bool seenval(const char c) { return seen(c) && has_value(); }
|
||||
@@ -224,20 +224,20 @@ public:
|
||||
if (c == '\0' || c == ' ') break;
|
||||
if (c == 'E' || c == 'e') {
|
||||
*e = '\0';
|
||||
const float ret = strtof(value_ptr, NULL);
|
||||
const float ret = strtof(value_ptr, nullptr);
|
||||
*e = c;
|
||||
return ret;
|
||||
}
|
||||
++e;
|
||||
}
|
||||
return strtof(value_ptr, NULL);
|
||||
return strtof(value_ptr, nullptr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Code value as a long or ulong
|
||||
static inline int32_t value_long() { return value_ptr ? strtol(value_ptr, NULL, 10) : 0L; }
|
||||
static inline uint32_t value_ulong() { return value_ptr ? strtoul(value_ptr, NULL, 10) : 0UL; }
|
||||
static inline int32_t value_long() { return value_ptr ? strtol(value_ptr, nullptr, 10) : 0L; }
|
||||
static inline uint32_t value_ulong() { return value_ptr ? strtoul(value_ptr, nullptr, 10) : 0UL; }
|
||||
|
||||
// Code value for use as time
|
||||
static inline millis_t value_millis() { return value_ulong(); }
|
||||
|
||||
Reference in New Issue
Block a user