[Fix] coding style and remove extra comments
authorAbhay agarwal <ay.agarwal@samsung.com>
Mon, 9 Sep 2019 06:58:44 +0000 (12:28 +0530)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 16 Sep 2019 12:01:37 +0000 (21:01 +0900)
Change-Id: I455546293fc2982e5433c52998ab42b580bad1b1
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
ua-daemon/src/ua-manager-db.c

index 71e4bb5..6c91c7a 100644 (file)
@@ -248,9 +248,6 @@ static int __uam_db_check_table_creation(void)
        FUNC_ENTRY;
        int error_code = UAM_ERROR_DB_FAILED;
 
-       /*
-        * 4) Each __is_table_existing() open DB file again and again.. it is redundant
-        */
        if (!__uam_db_is_table_existing(UAM_DB_USERDATA_TABLE))
                retv_if(UAM_ERROR_NONE != __uam_db_create_table(CREATE_USERDATA_TABLE), error_code);
 
@@ -301,7 +298,7 @@ int _uam_db_initialize_once(void)
 
        int max_retries = 2;
 
-       do{
+       do {
                /* open database */
                retv_if(SQLITE_OK != __uam_db_open(), UAM_ERROR_DB_FAILED);
 
@@ -310,14 +307,12 @@ int _uam_db_initialize_once(void)
                        sqlite3_close(database);
                        unlink(DATABASE_FULL_PATH);
                        database = NULL;
+                       retv_if(0 == max_retries, UAM_ERROR_DB_FAILED);
                } else {
                        break;
                }
-       } while(max_retries--);
+       } while (max_retries--);
 
-       /*
-        * 3) Default journal mode is PERIST so it seems use-less.
-        */
        /* Enable persist journal mode */
        sql = sqlite3_mprintf("PRAGMA journal_mode = PERSIST");
        retv_if(UAM_ERROR_NONE != __uam_db_exec_sql(sql, NULL), UAM_ERROR_DB_FAILED);