[vlc-devel] [PATCH] vlc_es: favor structure copying to memcpy
Steve Lhomme
robux4 at videolabs.io
Wed Jul 19 16:06:03 CEST 2017
It should not have performance impacts but provides stronger typing.
---
include/vlc_es.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/vlc_es.h b/include/vlc_es.h
index 2c622b50b9..d67b5bd3ef 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -382,13 +382,13 @@ static inline void video_format_Init( video_format_t *p_src, vlc_fourcc_t i_chro
*/
static inline int video_format_Copy( video_format_t *p_dst, const video_format_t *p_src )
{
- memcpy( p_dst, p_src, sizeof( *p_dst ) );
+ *p_dst = *p_src;
if( p_src->p_palette )
{
p_dst->p_palette = (video_palette_t *) malloc( sizeof( video_palette_t ) );
if( !p_dst->p_palette )
return VLC_ENOMEM;
- memcpy( p_dst->p_palette, p_src->p_palette, sizeof( *p_dst->p_palette ) );
+ *p_dst->p_palette = *p_src->p_palette;
}
return VLC_SUCCESS;
}
--
2.12.1
More information about the vlc-devel
mailing list