[vlc-commits] addons: vorepository: Simplify

Hugo Beauzée-Luyssen git at videolan.org
Fri Nov 3 17:03:29 CET 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Nov  2 11:36:03 2017 +0100| [387c3a1311aa6400dd0925b109dcb51dbe52ccd4] | committer: Hugo Beauzée-Luyssen

addons: vorepository: Simplify

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

 modules/misc/addons/vorepository.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/modules/misc/addons/vorepository.c b/modules/misc/addons/vorepository.c
index b014d49fef..c80172dd7c 100644
--- a/modules/misc/addons/vorepository.c
+++ b/modules/misc/addons/vorepository.c
@@ -345,29 +345,15 @@ static stream_t * vlc_stream_NewURL_ND( addons_finder_t *p_obj, const char *psz_
 
 static int Find( addons_finder_t *p_finder )
 {
-    bool b_done = false;
-
-    while ( !b_done )
-    {
-        char *psz_uri = NULL;
-
-        if ( ! asprintf( &psz_uri, ADDONS_REPO_SCHEMEHOST"/xml" ) ) return VLC_ENOMEM;
-        b_done = true;
-
-        stream_t *p_stream = vlc_stream_NewURL_ND( p_finder, psz_uri );
-        free( psz_uri );
-        if ( !p_stream ) return VLC_EGENERIC;
-
-        if ( ! ParseCategoriesInfo( p_finder, p_stream ) )
-        {
-            /* no more entries have been read: was last page or error */
-            b_done = true;
-        }
+    stream_t *p_stream = vlc_stream_NewURL_ND( p_finder,
+                                            ADDONS_REPO_SCHEMEHOST "/xml" );
+    if ( !p_stream )
+        return VLC_EGENERIC;
 
-        vlc_stream_Delete( p_stream );
-    }
+    int i_res = ParseCategoriesInfo( p_finder, p_stream );
+    vlc_stream_Delete( p_stream );
 
-    return VLC_SUCCESS;
+    return i_res > 0 ? VLC_SUCCESS : VLC_EGENERIC;
 }
 
 static int Retrieve( addons_finder_t *p_finder, addon_entry_t *p_entry )



More information about the vlc-commits mailing list