remove the unnecessary ref_count value. 68/54868/1 accepted/tizen/mobile/20151219.044042 accepted/tizen/tv/20151219.044505 accepted/tizen/wearable/20151219.044754 submit/tizen/20151218.093510 submit/tizen_common/20151229.144031 submit/tizen_common/20151229.154718
authorHyihong Chae <hh.chae@samsung.com>
Fri, 18 Dec 2015 09:25:33 +0000 (18:25 +0900)
committerHyihong Chae <hh.chae@samsung.com>
Fri, 18 Dec 2015 09:25:33 +0000 (18:25 +0900)
Change-Id: I7b4d72659979b727dfe148cd1925156e68068113
Signed-off-by: HyiHong Chae <hh.chae@samsung.com>
packaging/capi-network-mtp.spec
src/mtp_db.c

index 8b94159..e03c530 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-network-mtp
 Summary:    A MTP library in Native API
-Version:    1.2.3
+Version:    1.2.4
 Release:    1
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index 84e518d..fe4b685 100755 (executable)
@@ -28,7 +28,6 @@
 
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 static sqlite3 *db;
-int ref_count;
 
 mtp_error_e mtp_db_init()
 {
@@ -37,15 +36,11 @@ mtp_error_e mtp_db_init()
 
        MTP_DB_LOCK;
 
-       if (ref_count > 0) {
-               ref_count++;
-       } else if (db == NULL) {
+       if (db == NULL) {
                sql_ret = sqlite3_open_v2(MTP_DB_FILE, &db,
-                       SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
+                       SQLITE_OPEN_FULLMUTEX | SQLITE_OPEN_READWRITE, NULL);
 
-               if (sql_ret == SQLITE_OK)
-                       ref_count++;
-               else
+               if (sql_ret != SQLITE_OK)
                        ret = MTP_ERROR_DB;
        }
 
@@ -125,10 +120,7 @@ mtp_error_e mtp_db_deinit()
 
        MTP_DB_LOCK;
 
-       if (ref_count > 0)
-               ref_count--;
-
-       if (db != NULL && ref_count == 0) {
+       if (db != NULL) {
                sql_ret = sqlite3_close(db);
 
                if (sql_ret != SQLITE_OK)