From ae6cc33a5e6d2c0339d2ef586a6d186f4bc860ca Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 6 Sep 2024 21:33:09 -0700 Subject: [PATCH] Core: Improve future-proofing of struct initialization --- src/core/interface.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/interface.c b/src/core/interface.c index e5b7f8378..10d3433ab 100644 --- a/src/core/interface.c +++ b/src/core/interface.c @@ -101,9 +101,9 @@ static bool _rtcGenericDeserialize(struct mRTCSource* source, const struct mStat } void mRTCGenericSourceInit(struct mRTCGenericSource* rtc, struct mCore* core) { + memset(rtc, 0, sizeof(*rtc)); rtc->p = core; rtc->override = RTC_NO_OVERRIDE; - rtc->value = 0; rtc->d.sample = _rtcGenericSample; rtc->d.unixTime = _rtcGenericCallback; rtc->d.serialize = _rtcGenericSerialize; @@ -143,10 +143,8 @@ static void mRumbleIntegratorIntegrate(struct mRumble* rumble, uint32_t period) } void mRumbleIntegratorInit(struct mRumbleIntegrator* integrator) { + memset(integrator, 0, sizeof(*integrator)); integrator->d.reset = mRumbleIntegratorReset; integrator->d.setRumble = mRumbleIntegratorSetRumble; integrator->d.integrate = mRumbleIntegratorIntegrate; - - integrator->state = false; - integrator->timeOn = 0; }