[vlc-commits] renderer: factor code

Thomas Guillem git at videolan.org
Tue Sep 20 11:10:04 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Sep 20 10:23:15 2016 +0200| [832c749a31536e155e05b5160065c44dbff849b5] | committer: Thomas Guillem

renderer: factor code

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

 src/misc/renderer_discovery.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/misc/renderer_discovery.c b/src/misc/renderer_discovery.c
index 7b43177..4ef03d7 100644
--- a/src/misc/renderer_discovery.c
+++ b/src/misc/renderer_discovery.c
@@ -41,6 +41,15 @@ struct vlc_renderer_item_t
     atomic_uint refs;
 };
 
+static void
+item_free(vlc_renderer_item_t *p_item)
+{
+    free(p_item->psz_name);
+    free(p_item->psz_sout);
+    free(p_item->psz_icon_uri);
+    free(p_item);
+}
+
 vlc_renderer_item_t *
 vlc_renderer_item_new(const char *psz_name, const char *psz_uri,
                       const char *psz_extra_sout, const char *psz_icon_uri,
@@ -83,12 +92,7 @@ vlc_renderer_item_new(const char *psz_name, const char *psz_uri,
 error:
     vlc_UrlClean(&url);
     if (p_item != NULL)
-    {
-        free(p_item->psz_name);
-        free(p_item->psz_sout);
-        free(p_item->psz_icon_uri);
-        free(p_item);
-    }
+        item_free(p_item);
     return NULL;
 }
 
@@ -140,10 +144,7 @@ vlc_renderer_item_release(vlc_renderer_item_t *p_item)
 
     if (atomic_fetch_sub(&p_item->refs, 1) != 1)
         return;
-    free(p_item->psz_name);
-    free(p_item->psz_sout);
-    free(p_item->psz_icon_uri);
-    free(p_item);
+    item_free(p_item);
 }
 
 struct vlc_rd_probe



More information about the vlc-commits mailing list