[vlc-devel] [PATCH v2 1/3] fingerprinter: use partial/zero initialization

Alexandre Janniaux ajanni at videolabs.io
Mon Mar 23 19:03:40 CET 2020


Using memset to zero a struct with pointers isn't guaranteed to set
those pointers to NULL and is less elegant than using partial
initialization.
---
 modules/misc/fingerprinter.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/modules/misc/fingerprinter.c b/modules/misc/fingerprinter.c
index c96c471eb3..7a6bfc847d 100644
--- a/modules/misc/fingerprinter.c
+++ b/modules/misc/fingerprinter.c
@@ -360,9 +360,8 @@ static void *Run( void *opaque )
             char *psz_uri = input_item_GetURI( p_data->p_item );
             if ( psz_uri != NULL )
             {
-                 acoustid_fingerprint_t acoustid_print;
+                 acoustid_fingerprint_t acoustid_print = {0};
 
-                 memset( &acoustid_print , 0, sizeof (acoustid_print) );
                 /* overwrite with hint, as in this case, fingerprint's session will be truncated */
                 if ( p_data->i_duration )
                      acoustid_print.i_duration = p_data->i_duration;
-- 
2.25.2



More information about the vlc-devel mailing list