From f6fa085fe4d666c63193f612b59a690ac1786d58 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 31 Jul 2024 00:01:45 +0300 Subject: [PATCH] ref: gl: replace same struct type memcpys by assignments --- ref/gl/gl_context.c | 4 ++-- ref/gl/gl_rpart.c | 3 +-- ref/gl/gl_sprite.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ref/gl/gl_context.c b/ref/gl/gl_context.c index 0c286a7c..f1f926e1 100644 --- a/ref/gl/gl_context.c +++ b/ref/gl/gl_context.c @@ -569,8 +569,8 @@ int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, return 0; // fill in our callbacks - memcpy( funcs, &gReffuncs, sizeof( ref_interface_t )); - memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t )); + *funcs = gReffuncs; + gEngfuncs = *engfuncs; gpGlobals = globals; gp_cl = (ref_client_t *)ENGINE_GET_PARM( PARM_GET_CLIENT_PTR ); diff --git a/ref/gl/gl_rpart.c b/ref/gl/gl_rpart.c index 8fb7e6d8..f43e034e 100644 --- a/ref/gl/gl_rpart.c +++ b/ref/gl/gl_rpart.c @@ -281,7 +281,6 @@ void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean trans_pass, f { ref_instance_t oldRI = RI; - memcpy( &oldRI, &RI, sizeof( ref_instance_t )); R_SetupRefParams( rvp ); R_SetupFrustum(); R_SetupGL( false ); // don't touch GL-states @@ -290,5 +289,5 @@ void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean trans_pass, f gEngfuncs.CL_DrawEFX( frametime, trans_pass ); // restore internal state - memcpy( &RI, &oldRI, sizeof( ref_instance_t )); + RI = oldRI; } diff --git a/ref/gl/gl_sprite.c b/ref/gl/gl_sprite.c index 66313f01..4af49bcf 100644 --- a/ref/gl/gl_sprite.c +++ b/ref/gl/gl_sprite.c @@ -54,7 +54,7 @@ static const byte *R_SpriteLoadFrame( model_t *mod, const void *pin, mspritefram char texname[128]; int bytes = 1; - memcpy( &pinframe, pin, sizeof(dspriteframe_t)); + memcpy( &pinframe, pin, sizeof( dspriteframe_t )); if( sprite_version == SPRITE_VERSION_32 ) bytes = 4;