[libbluray-devel] Simplify

hpi1 git at videolan.org
Fri Sep 14 14:46:08 CEST 2012


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Sep 14 12:08:19 2012 +0300| [900332c9681980efa1a755b69d16f1b0aefe7e8e] | committer: hpi1

Simplify

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

 src/libbluray/bdj/bdj.c |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index f091b6a..096dff2 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -51,6 +51,13 @@ BDJAVA* bdj_open(const char *path, const char *start,
         return NULL;
     }
 
+    fptr_JNI_CreateJavaVM JNI_CreateJavaVM_fp = (fptr_JNI_CreateJavaVM)dl_dlsym(jvm_lib, "JNI_CreateJavaVM");
+
+    if (JNI_CreateJavaVM_fp == NULL) {
+        BD_DEBUG(DBG_BDJ | DBG_CRIT, "Couldn't find symbol JNI_CreateJavaVM.\n");
+        return NULL;
+    }
+
     BDJAVA* bdjava = malloc(sizeof(BDJAVA));
     bdjava->bd = bd;
     bdjava->reg = registers;
@@ -75,17 +82,6 @@ BDJAVA* bdj_open(const char *path, const char *start,
     args.options = option;
     args.ignoreUnrecognized = JNI_FALSE; // don't ignore unrecognized options
 
-    fptr_JNI_CreateJavaVM JNI_CreateJavaVM_fp = (fptr_JNI_CreateJavaVM)dl_dlsym(jvm_lib,
-            "JNI_CreateJavaVM");
-
-    if (JNI_CreateJavaVM_fp == NULL) {
-        free(bdjava);
-        free(option);
-        free(classpath_opt);
-        BD_DEBUG(DBG_BDJ | DBG_CRIT, "Couldn't find symbol JNI_CreateJavaVM.\n");
-        return NULL;
-    }
-
     int result = JNI_CreateJavaVM_fp(&bdjava->jvm, (void**) &bdjava->env, &args);
     free(option);
     free(classpath_opt);



More information about the libbluray-devel mailing list