[vlc-commits] cache: remove recursive function in save path

Rémi Denis-Courmont git at videolan.org
Thu Oct 27 21:49:16 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 27 22:25:20 2016 +0300| [343e358e58242276ba8df3e22947c81356dae67d] | committer: Rémi Denis-Courmont

cache: remove recursive function in save path

With the removal of CacheMerge() (in ddf09a29), the relative order of
submodules within a plugin no longer has any significance. So there is
no need for this recursion trick anymore.

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

 src/modules/cache.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/modules/cache.c b/src/modules/cache.c
index b6ad4e3..8d90a9e 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -605,20 +605,6 @@ error:
     return -1;
 }
 
-static int CacheSaveSubmodule( FILE *file, const module_t *p_module )
-{
-    if( !p_module )
-        return 0;
-    if( CacheSaveSubmodule( file, p_module->next ) )
-        goto error;
-    if (CacheSaveModule(file, p_module))
-        goto error;
-    return 0;
-
-error:
-    return -1;
-}
-
 static int CacheSaveBank(FILE *file, vlc_plugin_t *const *cache, size_t n)
 {
     uint32_t i_file_size = 0;
@@ -653,8 +639,10 @@ static int CacheSaveBank(FILE *file, vlc_plugin_t *const *cache, size_t n)
 
         i_submodule = module->submodule_count;
         SAVE_IMMEDIATE( i_submodule );
-        if (CacheSaveSubmodule (file, module->submodule))
-            goto error;
+
+        for (module = module->submodule; module != NULL; module = module->next)
+            if (CacheSaveModule(file, module))
+                goto error;
 
         /* Config stuff */
         if (CacheSaveModuleConfig(file, plugin))



More information about the vlc-commits mailing list