Skip to content

Commit

Permalink
BACKENDS: Silence GCC memset() warnings
Browse files Browse the repository at this point in the history
Recent GCC versions complain if you memset() a class or struct that
contain non-POD data types. Get around that by either initializing
the object when created, or by adding a reset() method.
  • Loading branch information
Torbjörn Andersson committed Jan 5, 2019
1 parent b965e67 commit 05f3fe4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backends/timer/default/default-timer.cpp
Expand Up @@ -35,6 +35,8 @@ struct TimerSlot {
uint32 nextFireTimeMicro; // microseconds part of nextFire

TimerSlot *next;

TimerSlot() : callback(nullptr), refCon(nullptr), interval(0), nextFireTime(0), nextFireTimeMicro(0), next(nullptr) {}
};

void insertPrioQueue(TimerSlot *head, TimerSlot *newSlot) {
Expand Down Expand Up @@ -63,7 +65,6 @@ DefaultTimerManager::DefaultTimerManager() :
_head(0) {

_head = new TimerSlot();
memset(_head, 0, sizeof(TimerSlot));
}

DefaultTimerManager::~DefaultTimerManager() {
Expand Down

0 comments on commit 05f3fe4

Please sign in to comment.