[vlc-commits] audioscrobbler: Remove useless allocations

Hugo Beauzée-Luyssen git at videolan.org
Wed Dec 2 16:36:30 CET 2015


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Nov 27 15:42:45 2015 +0100| [05e2ddbcc10d773f9fd2c13d48212a257e5c9346] | committer: Hugo Beauzée-Luyssen

audioscrobbler: Remove useless allocations

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=05e2ddbcc10d773f9fd2c13d48212a257e5c9346
---

 modules/misc/audioscrobbler.c |   21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/modules/misc/audioscrobbler.c b/modules/misc/audioscrobbler.c
index a02b3e8..f549110 100644
--- a/modules/misc/audioscrobbler.c
+++ b/modules/misc/audioscrobbler.c
@@ -196,18 +196,11 @@ static void ReadMetaData(intf_thread_t *p_this, input_thread_t *p_input)
     p_sys->b_submit_nowp = true;
 
     ALLOC_ITEM_META(p_sys->p_current_song.psz_b, Album);
-    if (!p_sys->p_current_song.psz_b)
-        p_sys->p_current_song.psz_b = calloc(1, 1);
-
     ALLOC_ITEM_META(p_sys->p_current_song.psz_m, TrackID);
-    if (!p_sys->p_current_song.psz_m)
-        p_sys->p_current_song.psz_m = calloc(1, 1);
+    ALLOC_ITEM_META(p_sys->p_current_song.psz_n, TrackNum);
 
     p_sys->p_current_song.i_l = input_item_GetDuration(p_item) / 1000000;
 
-    ALLOC_ITEM_META(p_sys->p_current_song.psz_n, TrackNum);
-    if (!p_sys->p_current_song.psz_n)
-        p_sys->p_current_song.psz_n = calloc(1, 1);
 #undef ALLOC_ITEM_META
 
     msg_Dbg(p_this, "Meta data registered");
@@ -770,10 +763,10 @@ static void *Run(void *data)
                 "&m=%s",
                 p_sys->p_current_song.psz_a,
                 p_sys->p_current_song.psz_t,
-                p_sys->p_current_song.psz_b,
+                p_sys->p_current_song.psz_b ? p_sys->p_current_song.psz_b : "",
                 p_sys->p_current_song.i_l,
-                p_sys->p_current_song.psz_n,
-                p_sys->p_current_song.psz_m
+                p_sys->p_current_song.psz_n ? p_sys->p_current_song.psz_n : "",
+                p_sys->p_current_song.psz_m ? p_sys->p_current_song.psz_m : ""
                 ) == -1)
             {   /* Out of memory */
                 vlc_mutex_unlock(&p_sys->lock);
@@ -804,9 +797,9 @@ static void *Run(void *data)
                         i_song,
                         i_song,
                         i_song, p_song->i_l,
-                        i_song, p_song->psz_b,
-                        i_song, p_song->psz_n,
-                        i_song, p_song->psz_m
+                        i_song, p_song->psz_b ? p_song->psz_b : "",
+                        i_song, p_song->psz_n ? p_song->psz_n : "",
+                        i_song, p_song->psz_m ? p_song->psz_m : ""
                        ) == -1)
                 {   /* Out of memory */
                         vlc_mutex_unlock(&p_sys->lock);



More information about the vlc-commits mailing list