Core: Improve future-proofing of struct initialization

This commit is contained in:
Vicki Pfau 2024-09-06 21:33:09 -07:00
parent 3a07834226
commit ae6cc33a5e
1 changed files with 2 additions and 4 deletions

View File

@ -101,9 +101,9 @@ static bool _rtcGenericDeserialize(struct mRTCSource* source, const struct mStat
} }
void mRTCGenericSourceInit(struct mRTCGenericSource* rtc, struct mCore* core) { void mRTCGenericSourceInit(struct mRTCGenericSource* rtc, struct mCore* core) {
memset(rtc, 0, sizeof(*rtc));
rtc->p = core; rtc->p = core;
rtc->override = RTC_NO_OVERRIDE; rtc->override = RTC_NO_OVERRIDE;
rtc->value = 0;
rtc->d.sample = _rtcGenericSample; rtc->d.sample = _rtcGenericSample;
rtc->d.unixTime = _rtcGenericCallback; rtc->d.unixTime = _rtcGenericCallback;
rtc->d.serialize = _rtcGenericSerialize; rtc->d.serialize = _rtcGenericSerialize;
@ -143,10 +143,8 @@ static void mRumbleIntegratorIntegrate(struct mRumble* rumble, uint32_t period)
} }
void mRumbleIntegratorInit(struct mRumbleIntegrator* integrator) { void mRumbleIntegratorInit(struct mRumbleIntegrator* integrator) {
memset(integrator, 0, sizeof(*integrator));
integrator->d.reset = mRumbleIntegratorReset; integrator->d.reset = mRumbleIntegratorReset;
integrator->d.setRumble = mRumbleIntegratorSetRumble; integrator->d.setRumble = mRumbleIntegratorSetRumble;
integrator->d.integrate = mRumbleIntegratorIntegrate; integrator->d.integrate = mRumbleIntegratorIntegrate;
integrator->state = false;
integrator->timeOn = 0;
} }