Change return type of media_db_disconnect() 35/211435/1 accepted/tizen/unified/20190806.072205 submit/tizen/20190805.053702
authorMinje Ahn <minje.ahn@samsung.com>
Mon, 5 Aug 2019 02:47:52 +0000 (11:47 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Mon, 5 Aug 2019 02:47:52 +0000 (11:47 +0900)
sqlite3_close_v2() always returns SQLITE_OK.
Therefore, it does not need to check the return value.

Change-Id: Ida11b4577d9553d377df02b83a5c07088ee3da40
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
lib/include/media-util-db.h
lib/media-util-db.c
src/mediadb-update.c

index 437b0a7..00727f6 100755 (executable)
@@ -32,7 +32,7 @@ extern "C" {
 
 int media_db_connect(sqlite3 **handle, uid_t uid, bool need_write);
 
-int media_db_disconnect(sqlite3 *handle);
+void media_db_disconnect(sqlite3 *handle);
 
 int media_db_request_update_db(const char *query_str, uid_t uid);
 
index e5fbf08..a3b877c 100755 (executable)
@@ -535,22 +535,12 @@ RETRY_CONN:
        return MS_MEDIA_ERR_NONE;
 }
 
-int media_db_disconnect(sqlite3 *handle)
+void media_db_disconnect(sqlite3 *handle)
 {
-       int ret = MS_MEDIA_ERR_NONE;
-
        MSAPI_DBG_FUNC();
 
-       MSAPI_RETVM_IF(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
-
-       ret = sqlite3_close_v2(handle);
-       if (SQLITE_OK != ret) {
-               MSAPI_DBG_ERR("error when db close [%s]", sqlite3_errmsg(handle));
-               handle = NULL;
-               return MS_MEDIA_ERR_DB_DISCONNECT_FAIL;
-       }
-
-       return MS_MEDIA_ERR_NONE;
+       if (handle)
+               sqlite3_close_v2(handle);
 }
 
 int media_db_request_update_db(const char *query_str, uid_t uid)
index bc89b35..5ae346b 100755 (executable)
@@ -82,9 +82,7 @@ static void __check_media_db(void)
        if (ret < 0)
                printf("Error svc_check_db\n");
 
-       ret = media_db_disconnect(db_handle);
-       if (ret < 0)
-               printf("Error svc_disconnect\n");
+       media_db_disconnect(db_handle);
 
        printf("Check media db done\n");
 
@@ -123,12 +121,7 @@ static int __get_storage_id(const char *path, char *storage_id, uid_t uid)
                dlclose(funcHandle);
                return -1;
        }
-       ret = media_db_disconnect(db_handle);
-       if (ret < 0) {
-               printf("Error svc_disconnect\n");
-               dlclose(funcHandle);
-               return -1;
-       }
+       media_db_disconnect(db_handle);
        printf("Start Scanning for [%s][%s]\n", path, storage_id);
 
        dlclose(funcHandle);