[libbluray-devel] simplify

hpi1 git at videolan.org
Tue Jan 6 15:39:30 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sat Jan  3 01:52:06 2015 +0200| [a46755874628f04d20f81ed9035e118657d9f98f] | committer: hpi1

simplify

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=a46755874628f04d20f81ed9035e118657d9f98f
---

 src/libbluray/bluray.c |   27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 473d491..6924f55 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -2603,27 +2603,22 @@ int bd_set_player_setting_str(BLURAY *bd, uint32_t idx, const char *s)
         case BLURAY_PLAYER_PERSISTENT_ROOT:
             if (!bd->bdjstorage) {
                 bd->bdjstorage = calloc(1, sizeof(BDJ_STORAGE));
+                if (!bd->bdjstorage) {
+                    return 0;
+                }
             }
             switch (idx) {
                 case BLURAY_PLAYER_CACHE_ROOT:
-                    if (bd->bdjstorage) {
-                        X_FREE(bd->bdjstorage->cache_root);
-                        bd->bdjstorage->cache_root = str_dup(s);
-                        BD_DEBUG(DBG_BDJ, "Cache root dir set to %s\n", bd->bdjstorage->cache_root);
-                        return 1;
-                    }
-                    else
-                        return 0;
+                    X_FREE(bd->bdjstorage->cache_root);
+                    bd->bdjstorage->cache_root = str_dup(s);
+                    BD_DEBUG(DBG_BDJ, "Cache root dir set to %s\n", bd->bdjstorage->cache_root);
+                    return 1;
 
                 case BLURAY_PLAYER_PERSISTENT_ROOT:
-                    if (bd->bdjstorage) {
-                        X_FREE(bd->bdjstorage->persistent_root);
-                        bd->bdjstorage->persistent_root = str_dup(s);
-                        BD_DEBUG(DBG_BDJ, "Persistent root dir set to %s\n", bd->bdjstorage->persistent_root);
-                        return 1;
-                    }
-                    else
-                        return 0;
+                    X_FREE(bd->bdjstorage->persistent_root);
+                    bd->bdjstorage->persistent_root = str_dup(s);
+                    BD_DEBUG(DBG_BDJ, "Persistent root dir set to %s\n", bd->bdjstorage->persistent_root);
+                    return 1;
             }
 #endif /* USING_BDJAVA */
         default:



More information about the libbluray-devel mailing list