pointless OOP

This commit is contained in:
rusefi 2018-08-31 21:38:14 -04:00
parent 351d36f9c0
commit 61d3eb177c
3 changed files with 21 additions and 8 deletions

View File

@ -141,7 +141,7 @@ WaveChart::WaveChart() {
}
void WaveChart::init() {
initLoggingExt(&logging, "wave chart", WAVE_LOGGING_BUFFER, sizeof(WAVE_LOGGING_BUFFER));
logging.initLoggingExt("wave chart", WAVE_LOGGING_BUFFER, sizeof(WAVE_LOGGING_BUFFER));
isInitialized = true;
reset();
}

View File

@ -115,6 +115,7 @@ static void vappendPrintf(Logging *logging, const char *fmt, va_list arg) {
}
}
// todo: replace with logging->appendPrintf
void appendPrintf(Logging *logging, const char *fmt, ...) {
efiAssertVoid(CUSTOM_ERR_6607, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#4");
va_list ap;
@ -123,12 +124,20 @@ void appendPrintf(Logging *logging, const char *fmt, ...) {
va_end(ap);
}
void initLoggingExt(Logging *logging, const char *name, char *buffer, int bufferSize) {
logging->name = name;
logging->buffer = buffer;
logging->bufferSize = bufferSize;
resetLogging(logging);
logging->isInitialized = true;
void Logging::appendPrintf(const char *fmt, ...) {
efiAssertVoid(CUSTOM_ERR_6607, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#4");
va_list ap;
va_start(ap, fmt);
vappendPrintf(this, fmt, ap);
va_end(ap);
}
void Logging::initLoggingExt(const char *name, char *buffer, int bufferSize) {
this->name = name;
this->buffer = buffer;
this->bufferSize = bufferSize;
resetLogging(this);
this->isInitialized = true;
}
int isInitialized(Logging *logging) {
@ -303,7 +312,7 @@ Logging::Logging() {
Logging::Logging(char const *name, char *buffer, int bufferSize) {
baseConstructor();
#if ! EFI_UNIT_TEST
initLoggingExt(this, name, buffer, bufferSize);
initLoggingExt(name, buffer, bufferSize);
#endif /* ! EFI_UNIT_TEST */
}

View File

@ -21,6 +21,10 @@ public:
void baseConstructor();
Logging();
Logging(const char *name, char *buffer, int bufferSize);
void initLoggingExt(const char *name, char *buffer, int bufferSize);
void append(const char *text);
void appendFast(const char *text);
void appendPrintf(const char *fmt, ...);
const char *name;
char SMALL_BUFFER[40];
/**