Start using some C++ 14 features.

This commit is contained in:
Markus F.X.J. Oberhumer
2020-12-08 05:40:17 +01:00
parent 361a3056cb
commit f7e2266c3f
62 changed files with 971 additions and 960 deletions
+6 -6
View File
@@ -38,19 +38,19 @@
**************************************************************************/
// ugly hacks
static screen_t *last_screen = NULL;
static screen_t *last_screen = nullptr;
screen_t *sobject_get_screen(void) { return last_screen; }
void sobject_destroy(screen_t *this) {
last_screen = NULL;
last_screen = nullptr;
if (!this)
return;
if (this->data) {
if (this->finalize)
this->finalize(this);
free(this->data);
this->data = NULL;
this->data = nullptr;
}
free(this);
}
@@ -58,12 +58,12 @@ void sobject_destroy(screen_t *this) {
screen_t *sobject_construct(const screen_t *c, size_t data_size) {
screen_t *this;
last_screen = NULL;
last_screen = nullptr;
/* allocate object */
this = (screen_t *) malloc(sizeof(*this));
if (!this)
return NULL;
return nullptr;
/* copy function table */
*this = *c;
@@ -72,7 +72,7 @@ screen_t *sobject_construct(const screen_t *c, size_t data_size) {
this->data = (struct screen_data_t *) malloc(data_size);
if (!this->data) {
free(this);
return NULL;
return nullptr;
}
memset(this->data, 0, data_size);