engine: use zero initializers instead of memset

This commit is contained in:
Alibek Omarov 2025-01-14 12:11:10 +03:00
parent 04125284a3
commit 49426721d8
4 changed files with 5 additions and 9 deletions

View file

@ -624,11 +624,10 @@ static void CL_ReadDemoUserCmd( qboolean discard )
if( !discard ) if( !discard )
{ {
usercmd_t nullcmd; const usercmd_t nullcmd = { 0 };
sizebuf_t buf; sizebuf_t buf;
demoangle_t *a; demoangle_t *a;
memset( &nullcmd, 0, sizeof( nullcmd ));
MSG_Init( &buf, "UserCmd", data, sizeof( data )); MSG_Init( &buf, "UserCmd", data, sizeof( data ));
// a1ba: I have no proper explanation why // a1ba: I have no proper explanation why

View file

@ -593,7 +593,7 @@ CL_CreateCmd
*/ */
static void CL_CreateCmd( void ) static void CL_CreateCmd( void )
{ {
usercmd_t nullcmd, *cmd; usercmd_t nullcmd = { 0 }, *cmd;
runcmd_t *pcmd; runcmd_t *pcmd;
qboolean active; qboolean active;
double accurate_ms; double accurate_ms;
@ -645,7 +645,6 @@ static void CL_CreateCmd( void )
} }
else else
{ {
memset( &nullcmd, 0, sizeof( nullcmd ));
cmd = &nullcmd; cmd = &nullcmd;
} }

View file

@ -104,7 +104,7 @@ static void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *p
string pakname; string pakname;
byte md5[16]; byte md5[16];
file_t *fout; file_t *fout;
MD5Context_t ctx; MD5Context_t ctx = { 0 };
if( !COM_CheckString( filename )) if( !COM_CheckString( filename ))
return; return;
@ -125,7 +125,6 @@ static void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *p
} }
// let's hash it. // let's hash it.
memset( &ctx, 0, sizeof( MD5Context_t ));
MD5Init( &ctx ); MD5Init( &ctx );
if( pData == NULL ) if( pData == NULL )
@ -214,7 +213,7 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
file_t *file_src; file_t *file_src;
file_t *file_dst; file_t *file_dst;
byte md5[16]; byte md5[16];
MD5Context_t ctx; MD5Context_t ctx = { 0 };
if( pData == NULL && pFile == NULL ) if( pData == NULL && pFile == NULL )
return; return;
@ -226,7 +225,6 @@ void HPAK_AddLump( qboolean bUseQueue, const char *name, resource_t *pResource,
} }
// hash it // hash it
memset( &ctx, 0, sizeof( MD5Context_t ));
MD5Init( &ctx ); MD5Init( &ctx );
if( !pData ) if( !pData )

View file

@ -611,7 +611,7 @@ void GAME_EXPORT ID_SetCustomClientID( const char *id )
void ID_Init( void ) void ID_Init( void )
{ {
MD5Context_t hash = {0}; MD5Context_t hash = { 0 };
byte md5[16]; byte md5[16];
int i; int i;