fancy C++ s/NULL/nullptr/

This commit is contained in:
rusefi 2019-10-08 01:26:35 -04:00
parent 1ab488e4b4
commit 42dc9e3662
19 changed files with 33 additions and 43 deletions

View File

@ -110,7 +110,7 @@ public:
private:
Pid auxPid;
int index = 0;
ValueProvider3D *table = NULL;
ValueProvider3D *table = nullptr;
};
static AuxPidController instances[AUX_PID_COUNT];

View File

@ -325,7 +325,7 @@ static void fillWithSpaces(void) {
void updateHD44780lcd(void) {
MenuItem *p = tree.topVisible;
int screenY = 0;
for (; screenY < tree.linesCount && p != NULL; screenY++) {
for (; screenY < tree.linesCount && p != nullptr; screenY++) {
lcd_HD44780_set_position(screenY, 0);
char firstChar;
if (p == tree.current) {

View File

@ -38,7 +38,7 @@ EXTERN_ENGINE
tps_tps_Map3D_t tpsTpsMap("tpsTps");
static Logging *logger = NULL;
static Logging *logger = nullptr;
WallFuel::WallFuel() {
resetWF();

View File

@ -45,7 +45,7 @@ public:
uint32_t startOfDwell;
event_trigger_position_s dwellPosition;
event_trigger_position_s sparkPosition;
IgnitionEvent *next = NULL;
IgnitionEvent *next = nullptr;
/**
* @see globalSparkIdCoutner
*/
@ -54,7 +54,7 @@ public:
* [0, specs.cylindersCount)
*/
int cylinderIndex = 0;
char *name = NULL;
char *name = nullptr;
#if EFI_UNIT_TEST
Engine *engine;
#endif

View File

@ -11,9 +11,6 @@
MenuTree::MenuTree(MenuItem *root) {
this->root = root;
current = NULL;
linesCount = 0;
topVisible = NULL;
}
void MenuTree::init(MenuItem *first, int linesCount) {
@ -74,10 +71,10 @@ void MenuItem::baseConstructor(MenuItem * parent, lcd_line_e lcdLine, const char
this->text = text;
this->callback = callback;
firstChild = NULL;
lastChild = NULL;
topOfTheList = NULL;
next = NULL;
firstChild = nullptr;
lastChild = nullptr;
topOfTheList = nullptr;
next = nullptr;
index = 0;
// root element has NULL parent

View File

@ -69,9 +69,9 @@ public:
void init(MenuItem *first, int linesCount);
MenuItem *root;
int linesCount;
MenuItem *current;
MenuItem *topVisible;
int linesCount = 0;
MenuItem *current = nullptr;
MenuItem *topVisible = nullptr;
};

View File

@ -33,8 +33,6 @@ void SingleWave::setState(int switchIndex, pin_state_t state) {
}
MultiWave::MultiWave() {
channels = NULL;
switchTimes = NULL;
reset();
}

View File

@ -77,13 +77,13 @@ public:
* Number of signal channels
*/
int waveCount;
SingleWave *channels;
SingleWave *channels = nullptr;
//private:
/**
* values in the (0..1] range which refer to points within the period at at which pin state should be changed
* So, in the simplest case we turn pin off at 0.3 and turn it on at 1 - that would give us a 70% duty cycle PWM
*/
float *switchTimes;
float *switchTimes = nullptr;
};
#endif /* EFI_WAVE_H_ */

View File

@ -31,7 +31,7 @@ static fsio8_Map3D_u8t * fsio8t_tables[] = {NULL, NULL, &fsioTable2, &fsioTable3
EXTERN_ENGINE;
LENameOrdinalPair * LE_FIRST = NULL;
LENameOrdinalPair * LE_FIRST = nullptr;
/**
* the main point of these static fields is that their constructor would register
@ -72,7 +72,7 @@ LEElement::LEElement() {
void LEElement::clear() {
action = LE_UNDEFINED;
next = NULL;
next = nullptr;
fValue = NAN;
iValue = 0;
}
@ -91,7 +91,7 @@ LECalculator::LECalculator() {
}
void LECalculator::reset() {
first = NULL;
first = nullptr;
stack.reset();
currentCalculationLogPosition = 0;
memset(calcLogAction, 0, sizeof(calcLogAction));
@ -405,8 +405,8 @@ static char parsingBuffer[64];
LEElement *LEElementPool::parseExpression(const char * line) {
LEElement *first = NULL;
LEElement *last = NULL;
LEElement *first = nullptr;
LEElement *last = nullptr;
while (true) {
line = getNextToken(line, parsingBuffer, sizeof(parsingBuffer));

View File

@ -255,7 +255,7 @@ void OutputPin::unregisterOutput(brain_pin_e oldPin, brain_pin_e newPin) {
scheduleMsg(logger, "unregistering %s", hwPortname(oldPin));
#if EFI_GPIO_HARDWARE
brain_pin_markUnused(oldPin);
port = NULL;
port = nullptr;
#endif /* EFI_GPIO_HARDWARE */
}
}

View File

@ -64,7 +64,7 @@ void PID_AutoTune::reset() {
memset(lastPeaks, 0, sizeof(lastPeaks));
memset(lastInputs, 0, sizeof(lastInputs));
logger = NULL;
logger = nullptr;
input = output = 0;
SetLookbackSec(10);

View File

@ -152,7 +152,7 @@ int EventQueue::executeAll(efitime_t now) {
lastInExecutionList->next = current;
lastInExecutionList = current;
}
current->next = NULL;
current->next = nullptr;
} else {
/**
* The list is sorted. Once we find one action in the future, all the remaining ones

View File

@ -27,7 +27,7 @@
EXTERN_ENGINE
;
static Logging *logger = NULL;
static Logging *logger = nullptr;
/**
* http://en.wikipedia.org/wiki/Voltage_divider

View File

@ -58,7 +58,7 @@ void TriggerState::setShaftSynchronized(bool value) {
}
void TriggerState::resetTriggerState() {
triggerCycleCallback = NULL;
triggerCycleCallback = nullptr;
setShaftSynchronized(false);
toothed_previous_time = 0;

View File

@ -143,9 +143,9 @@ static void initWave(const char *name, int index) {
#endif
WaveReader::WaveReader() {
hw = NULL;
hw = nullptr;
last_wave_high_widthUs = 0;
name = NULL;
name = nullptr;
fallEventCounter = riseEventCounter = 0;
currentRevolutionCounter = 0;
prevTotalOnTimeUs = 0;

View File

@ -340,7 +340,7 @@ void initSpiModule(SPIDriver *driver, brain_pin_e sck, brain_pin_e miso,
}
void initSpiCs(SPIConfig *spiConfig, brain_pin_e csPin) {
spiConfig->end_cb = NULL;
spiConfig->end_cb = nullptr;
ioportid_t port = getHwPort("spi", csPin);
ioportmask_t pin = getHwPin("spi", csPin);
spiConfig->ssport = port;

View File

@ -296,11 +296,6 @@ void Logging::appendPrintf(const char *fmt, ...) {
#endif /* ! EFI_UNIT_TEST */
Logging::Logging() {
name = NULL;
buffer = NULL;
linePointer = NULL;
bufferSize = 0;
isInitialized = false;
}
Logging::Logging(char const *name, char *buffer, int bufferSize) : Logging(){

View File

@ -25,21 +25,21 @@ public:
void append(const char *text);
void appendFast(const char *text);
void appendPrintf(const char *fmt, ...);
const char *name;
const char *name = nullptr;
char SMALL_BUFFER[40];
/**
* Zero-terminated buffer of pending debug message
*
* Unless a larger external buffer is specified, this is just a pointer to DEFAULT_BUFFER
*/
char *buffer;
char *buffer = nullptr;
/**
* This pointer is always pointing at the position within the buffer into which next
* write operation would append additional data
*/
char *linePointer;
int bufferSize;
volatile bool isInitialized;
char *linePointer = nullptr;
int bufferSize = 0;
volatile bool isInitialized = false;
};
class LoggingWithStorage : public Logging {

View File

@ -128,7 +128,7 @@ void EngineTestHelper::fireTriggerEvents2(int count, float durationMs) {
void EngineTestHelper::clearQueue() {
engine.executor.executeAll(99999999); // this is needed to clear 'isScheduled' flag
ASSERT_EQ( 0, engine.executor.size()) << "Failed to clearQueue";
engine.iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
engine.ignitionEventsHead = nullptr; // let's drop whatever was scheduled just to start from a clean state
}
int EngineTestHelper::executeActions() {