summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjusung son <jusung07.son@samsung.com>2016-01-04 19:15:51 +0900
committerjusung son <jusung07.son@samsung.com>2016-01-05 13:30:30 +0900
commit661d6e334db995552335c4db8aeb085a656aee1f (patch)
tree70e55ad6097049d86a73ed194c5b22229e69e325
parente789777c92a0c346c1dcf6480873e9e77039a62c (diff)
downloadshortcut-661d6e334db995552335c4db8aeb085a656aee1f.tar.gz
shortcut-661d6e334db995552335c4db8aeb085a656aee1f.tar.bz2
shortcut-661d6e334db995552335c4db8aeb085a656aee1f.zip
Apply coding rule
Change-Id: I08a75b8958f1ee720e59b000e04143469ea767b9 Signed-off-by: jusung son <jusung07.son@samsung.com>
-rwxr-xr-x[-rw-r--r--]lib/src/shortcut_manager.c142
-rwxr-xr-xpkgmgr_shortcut/src/dlist.c31
-rwxr-xr-xpkgmgr_shortcut/src/service_register.c101
-rwxr-xr-xtest/application.c5
4 files changed, 114 insertions, 165 deletions
diff --git a/lib/src/shortcut_manager.c b/lib/src/shortcut_manager.c
index 9192faa..2b35089 100644..100755
--- a/lib/src/shortcut_manager.c
+++ b/lib/src/shortcut_manager.c
@@ -83,9 +83,8 @@ static struct packet *add_shortcut_handler(pid_t pid, int handle, const struct p
int ret = SHORTCUT_ERROR_NONE;
int sender_pid;
- if (!packet) {
+ if (!packet)
return NULL;
- }
if (packet_get(packet, "ississi", &sender_pid, &appid, &name, &type, &content, &icon, &allow_duplicate) != 7) {
ErrPrint("Invalid packet\n");
@@ -94,15 +93,13 @@ static struct packet *add_shortcut_handler(pid_t pid, int handle, const struct p
DbgPrint("appid[%s], name[%s], type[0x%x], content[%s], icon[%s] allow_duplicate[%d]\n", appid, name, type, content, icon, allow_duplicate);
- if (s_info.server_cb.request_cb) {
+ if (s_info.server_cb.request_cb)
ret = s_info.server_cb.request_cb(appid, name, type, content, icon, sender_pid, -1.0f, allow_duplicate, s_info.server_cb.data);
- } else {
+ else
ret = SHORTCUT_ERROR_NOT_SUPPORTED;
- }
- if (ret != SHORTCUT_ERROR_NONE) {
+ if (ret != SHORTCUT_ERROR_NONE)
ErrPrint("ret [%d]\n", ret);
- }
return packet_create_reply(packet, "i", ret);
}
@@ -121,9 +118,8 @@ static struct packet *add_shortcut_widget_handler(pid_t pid, int handle, const s
int ret = SHORTCUT_ERROR_NONE;
int sender_pid;
- if (!packet) {
+ if (!packet)
return NULL;
- }
if (packet_get(packet, "ississdi", &sender_pid, &widget_id, &name, &type, &content, &icon, &period, &allow_duplicate) != 8) {
ErrPrint("Invalid packet\n");
@@ -132,15 +128,13 @@ static struct packet *add_shortcut_widget_handler(pid_t pid, int handle, const s
DbgPrint("widget_id[%s], name[%s], type[0x%x], content[%s], icon[%s], period[%lf], allow_duplicate[%d]\n", widget_id, name, type, content, icon, period, allow_duplicate);
- if (s_info.server_cb.request_cb) {
+ if (s_info.server_cb.request_cb)
ret = s_info.server_cb.request_cb(widget_id, name, type, content, icon, sender_pid, period, allow_duplicate, s_info.server_cb.data);
- } else {
+ else
ret = 0;
- }
- if (ret != SHORTCUT_ERROR_NONE) {
+ if (ret != SHORTCUT_ERROR_NONE)
ErrPrint("ret [%d]\n", ret);
- }
return packet_create_reply(packet, "i", ret);
}
@@ -164,13 +158,11 @@ static void master_started_cb(keynode_t *node, void *user_data)
{
int state = 0;
- if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0) {
+ if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0)
ErrPrint("Unable to get \"%s\"\n", VCONFKEY_MASTER_STARTED);
- }
- if (state == 1 && make_connection() == SHORTCUT_ERROR_NONE) {
+ if (state == 1 && make_connection() == SHORTCUT_ERROR_NONE)
(void)vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb);
- }
}
static gboolean timeout_cb(void *data)
@@ -178,11 +170,10 @@ static gboolean timeout_cb(void *data)
int ret;
ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL);
- if (ret < 0) {
+ if (ret < 0)
ErrPrint("Failed to add vconf for service state [%d]\n", ret);
- } else {
+ else
DbgPrint("vconf is registered\n");
- }
master_started_cb(NULL, NULL);
@@ -203,9 +194,8 @@ static int disconnected_cb(int handle, void *data)
if (!s_info.timer_id) {
s_info.server_fd = SHORTCUT_ERROR_INVALID_PARAMETER;
s_info.timer_id = g_timeout_add(1000, timeout_cb, NULL);
- if (!s_info.timer_id) {
+ if (!s_info.timer_id)
ErrPrint("Unable to add timer\n");
- }
}
return 0;
}
@@ -278,16 +268,14 @@ static char *_shortcut_get_pkgname_by_pid(void)
snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
fd = open(buf, O_RDONLY);
- if (fd < 0) {
+ if (fd < 0)
return NULL;
- }
ret = read(fd, pkgname, sizeof(pkgname) - 1);
close(fd);
- if (ret <= 0) {
+ if (ret <= 0)
return NULL;
- }
pkgname[ret] = '\0';
/*!
@@ -296,9 +284,8 @@ static char *_shortcut_get_pkgname_by_pid(void)
* if the system is not going wrong.
*/
} else {
- if (strlen(pkgname) <= 0) {
+ if (strlen(pkgname) <= 0)
return NULL;
- }
}
dup_pkgname = strdup(pkgname);
@@ -312,9 +299,8 @@ static char *_shortcut_get_pkgname_by_pid(void)
EAPI int shortcut_set_request_cb(shortcut_request_cb request_cb, void *data)
{
- if (request_cb == NULL) {
+ if (request_cb == NULL)
return SHORTCUT_ERROR_INVALID_PARAMETER;
- }
s_info.server_cb.request_cb = request_cb;
s_info.server_cb.data = data;
@@ -362,13 +348,13 @@ static int shortcut_send_cb(pid_t pid, int handle, const struct packet *packet,
ret = SHORTCUT_ERROR_NONE;
}
- if (item->result_internal_cb) {
+ if (item->result_internal_cb)
ret = item->result_internal_cb(ret, pid, item->data);
- } else if (item->result_cb) {
+ else if (item->result_cb)
ret = item->result_cb(ret, item->data);
- } else {
+ else
ret = SHORTCUT_ERROR_NONE;
- }
+
free(item);
return ret;
}
@@ -394,6 +380,12 @@ EAPI int shortcut_add_to_home(const char *name, shortcut_type type, const char *
struct result_cb_item *item;
char *appid = NULL;
int ret;
+ static struct method service_table[] = {
+ {
+ .cmd = NULL,
+ .handler = NULL,
+ },
+ };
if (ADD_TO_HOME_IS_DYNAMICBOX(type)) {
ErrPrint("Invalid type used for adding a shortcut\n");
@@ -408,31 +400,23 @@ EAPI int shortcut_add_to_home(const char *name, shortcut_type type, const char *
}
if (s_info.client_fd < 0) {
- static struct method service_table[] = {
- {
- .cmd = NULL,
- .handler = NULL,
- },
- };
-
s_info.client_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table);
if (s_info.client_fd < 0) {
- if (appid) {
+ if (appid)
free(appid);
- }
- if (shortcut_is_master_ready() == 1) {
+
+ if (shortcut_is_master_ready() == 1)
return SHORTCUT_ERROR_PERMISSION_DENIED;
- } else {
+ else
return SHORTCUT_ERROR_COMM;
- }
}
}
item = malloc(sizeof(*item));
if (!item) {
- if (appid) {
+ if (appid)
free(appid);
- }
+
ErrPrint("Heap: %d\n", errno);
return SHORTCUT_ERROR_OUT_OF_MEMORY;
}
@@ -441,36 +425,34 @@ EAPI int shortcut_add_to_home(const char *name, shortcut_type type, const char *
item->result_internal_cb = NULL;
item->data = data;
- if (!name) {
+ if (!name)
name = "";
- }
- if (!uri) {
+ if (!uri)
uri = "";
- }
- if (!icon) {
+ if (!icon)
icon = "";
- }
+
packet = packet_create("add_shortcut", "ississi", getpid(), appid, name, type, uri, icon, allow_duplicate);
if (!packet) {
ErrPrint("Failed to build a packet\n");
- if (appid) {
+ if (appid)
free(appid);
- }
- if (item) {
+
+ if (item)
free(item);
- }
+
return SHORTCUT_ERROR_FAULT;
}
ret = com_core_packet_async_send(s_info.client_fd, packet, 0.0f, shortcut_send_cb, item);
packet_destroy(packet);
if (ret < 0) {
- if (item) {
+ if (item)
free(item);
- }
+
com_core_packet_client_fini(s_info.client_fd);
s_info.client_fd = SHORTCUT_ERROR_INVALID_PARAMETER;
return SHORTCUT_ERROR_COMM;
@@ -487,6 +469,12 @@ EAPI int shortcut_add_to_home_widget(const char *name, shortcut_widget_size_e si
char *appid = NULL;
int ret;
int err = SHORTCUT_ERROR_NONE;
+ static struct method service_table[] = {
+ {
+ .cmd = NULL,
+ .handler = NULL,
+ },
+ };
if (name == NULL) {
ErrPrint("AppID is null\n");
@@ -508,13 +496,6 @@ EAPI int shortcut_add_to_home_widget(const char *name, shortcut_widget_size_e si
}
if (s_info.client_fd < 0) {
- static struct method service_table[] = {
- {
- .cmd = NULL,
- .handler = NULL,
- },
- };
-
s_info.client_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table);
if (s_info.client_fd < 0) {
err = SHORTCUT_ERROR_COMM;
@@ -630,9 +611,9 @@ static inline int get_i18n_name(const char *lang, int id, char **name, char **ic
if (!*icon) {
ErrPrint("strdup: %d\n", errno);
ret = -ENOMEM;
- if (name && *name) {
+ if (name && *name)
free(*name);
- }
+
goto out;
}
} else {
@@ -650,10 +631,10 @@ out:
static inline char *cur_locale(void)
{
char *language;
+ char *ptr;
+
language = vconf_get_str(VCONFKEY_LANGSET);
if (language) {
- char *ptr;
-
ptr = language;
while (*ptr) {
if (*ptr == '.') {
@@ -661,17 +642,15 @@ static inline char *cur_locale(void)
break;
}
- if (*ptr == '_') {
+ if (*ptr == '_')
*ptr = '-';
- }
ptr++;
}
} else {
language = strdup("en-us");
- if (!language) {
+ if (!language)
ErrPrint("Heap: %d\n", errno);
- }
}
return language;
@@ -692,13 +671,11 @@ EAPI int shortcut_get_list(const char *package_name, shortcut_list_cb list_cb, v
int cnt;
char *language;
- if (list_cb == NULL) {
+ if (list_cb == NULL)
return SHORTCUT_ERROR_INVALID_PARAMETER;
- }
- if (!s_info.db_opened) {
+ if (!s_info.db_opened)
s_info.db_opened = (open_db() == 0);
- }
if (!s_info.db_opened) {
ErrPrint("Failed to open a DB\n");
@@ -775,9 +752,10 @@ EAPI int shortcut_get_list(const char *package_name, shortcut_list_cb list_cb, v
* \todo
* Implement the "GET LOCALE" code
*/
- if (get_i18n_name(language, id, &i18n_name, &i18n_icon) < 0) {
+ /* if (get_i18n_name(language, id, &i18n_name, &i18n_icon) < 0) { */
/* Okay, we can't manage this. just use the fallback string */
- }
+ /* } */
+ get_i18n_name(language, id, &i18n_name, &i18n_icon);
cnt++;
if (list_cb(package_name, (i18n_icon != NULL ? i18n_icon : (char *)icon), (i18n_name != NULL ? i18n_name : (char *)name), (char *)extra_key, (char *)extra_data, data) < 0) {
diff --git a/pkgmgr_shortcut/src/dlist.c b/pkgmgr_shortcut/src/dlist.c
index 97c9545..9cdf097 100755
--- a/pkgmgr_shortcut/src/dlist.c
+++ b/pkgmgr_shortcut/src/dlist.c
@@ -46,9 +46,8 @@ struct dlist *dlist_append(struct dlist *list, void *data)
struct dlist *item;
item = malloc(sizeof(*item));
- if (!item) {
+ if (!item)
return NULL;
- }
item->next = NULL;
item->data = data;
@@ -73,9 +72,8 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
struct dlist *item;
item = malloc(sizeof(*item));
- if (!item) {
+ if (!item)
return NULL;
- }
item->data = data;
@@ -83,9 +81,8 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
item->prev = item;
item->next = NULL;
} else {
- if (list->prev->next) {
+ if (list->prev->next)
list->prev->next = item;
- }
item->prev = list->prev;
item->next = list;
@@ -102,26 +99,25 @@ struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
if (!list || !l)
return NULL;
- if (l == list) {
+ if (l == list)
list = l->next;
- } else {
+ else
l->prev->next = l->next;
- }
- if (l->next) {
+ if (l->next)
l->next->prev = l->prev;
- }
+
/*!
* \note
* If the removed entry 'l' has no next element, it is the last element.
* In this case, check the existence of the list first,
- * and if the list is not empty, update the 'prev' of the list (which is a head element of the list)
+ * and if the list is not empty, update the 'prev' of the list (which is a head element of the list)
*
* If we didn't care about this, the head element(list) can indicates the invalid element.
*/
- else if (list) {
+ else if (list)
list->prev = l->prev;
- }
+
free(l);
return list;
@@ -133,9 +129,8 @@ struct dlist *dlist_find_data(struct dlist *list, void *data)
void *_data;
dlist_foreach(list, l, _data) {
- if (data == _data) {
+ if (data == _data)
return l;
- }
}
return NULL;
@@ -177,9 +172,9 @@ struct dlist *dlist_nth(struct dlist *l, int nth)
i = 0;
for (n = l; n; n = n->next) {
- if (i == nth) {
+ if (i == nth)
return n;
- }
+
i++;
}
diff --git a/pkgmgr_shortcut/src/service_register.c b/pkgmgr_shortcut/src/service_register.c
index db0b89c..2f20a50 100755
--- a/pkgmgr_shortcut/src/service_register.c
+++ b/pkgmgr_shortcut/src/service_register.c
@@ -149,9 +149,8 @@ static void db_create_version(void)
return;
}
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
ErrPrint("No changes to DB\n");
- }
}
static int set_version(int version)
@@ -227,15 +226,14 @@ static int get_version(void)
int ret;
ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
+ if (ret != SQLITE_OK)
return -ENOSYS;
- }
- if (sqlite3_step(stmt) != SQLITE_ROW) {
+
+ if (sqlite3_step(stmt) != SQLITE_ROW)
ret = -ENOENT;
- } else {
+ else
ret = sqlite3_column_int(stmt, 0);
- }
sqlite3_reset(stmt);
sqlite3_clear_bindings(stmt);
@@ -261,9 +259,8 @@ static void db_create_table(void)
return;
}
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
ErrPrint("No changes to DB\n");
- }
ddl = "CREATE TABLE shortcut_name (id INTEGER, pkgid TEXT, lang TEXT, name TEXT, icon TEXT)";
if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
@@ -271,9 +268,8 @@ static void db_create_table(void)
return;
}
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
ErrPrint("No changes to DB\n");
- }
db_create_version();
}
@@ -288,9 +284,8 @@ static void alter_shortcut_icon(void)
return;
}
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
ErrPrint("No changes to DB\n");
- }
}
static void alter_shortcut_name(void)
@@ -303,9 +298,8 @@ static void alter_shortcut_name(void)
return;
}
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
ErrPrint("No changes to DB\n");
- }
}
static void alter_shortcut_service(void)
@@ -318,9 +312,8 @@ static void alter_shortcut_service(void)
return;
}
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
ErrPrint("No changes to DB\n");
- }
}
static int db_remove_by_pkgid(const char *pkgid)
@@ -351,9 +344,8 @@ static int db_remove_by_pkgid(const char *pkgid)
ret = -EIO;
ErrPrint("Failed to execute the DML for %s\n", pkgid);
} else {
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
DbgPrint("No changed\n");
- }
}
out:
@@ -374,25 +366,24 @@ static void do_upgrade_db_schema(void)
db_create_version();
/* Need to create version table */
case -ENOENT:
- if (set_version(1) < 0) {
+ if (set_version(1) < 0)
ErrPrint("Failed to set version\n");
- }
+
/* Need to set version */
alter_shortcut_name();
alter_shortcut_service();
case 1:
alter_shortcut_icon();
- if (update_version(2) < 0) {
+ if (update_version(2) < 0)
ErrPrint("Failed to update version\n");
- }
+
case 2:
break;
default:
/* Need to update version */
DbgPrint("Old version: %d\n", version);
- if (update_version(2) < 0) {
+ if (update_version(2) < 0)
ErrPrint("Failed to update version\n");
- }
alter_shortcut_name();
alter_shortcut_service();
@@ -446,9 +437,9 @@ static int db_remove_record(const char *pkgid, const char *appid, const char *ke
ErrPrint("Failed to execute the DML for %s - %s(%s)\n", appid, key, data);
}
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
DbgPrint("No changes\n");
- }
+
out:
sqlite3_reset(stmt);
@@ -486,9 +477,8 @@ static int db_remove_name_by_pkgid(const char *pkgid)
goto out;
}
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
DbgPrint("No chnages\n");
- }
out:
sqlite3_reset(stmt);
@@ -527,9 +517,8 @@ static int db_remove_name(int id)
goto out;
}
- if (sqlite3_changes(s_info.handle) == 0) {
+ if (sqlite3_changes(s_info.handle) == 0)
DbgPrint("No changes\n");
- }
out:
sqlite3_reset(stmt);
@@ -757,18 +746,16 @@ static int db_init(void)
return -EINVAL;
}
- if (!stat.st_size) {
+ if (!stat.st_size)
db_create_table();
- }
return 0;
}
static int db_fini(void)
{
- if (!s_info.handle) {
+ if (!s_info.handle)
return 0;
- }
db_util_close(s_info.handle);
s_info.handle = NULL;
@@ -780,7 +767,7 @@ static int do_uninstall(const char *appid)
{
int ret;
- ret = db_remove_by_pkgid(appid);
+ ret = db_remove_by_pkgid(appid);
if (ret < 0) {
ErrPrint("Failed to remove a record: %s\n", appid);
return ret;
@@ -801,9 +788,8 @@ static inline struct i18n_name *find_i18n_name(struct dlist *i18n_list, xmlChar
struct i18n_name *i18n;
dlist_foreach(i18n_list, l, i18n) {
- if (!xmlStrcasecmp(i18n->lang, lang)) {
+ if (!xmlStrcasecmp(i18n->lang, lang))
return i18n;
- }
}
return NULL;
@@ -858,9 +844,8 @@ static int do_install(xmlDocPtr docPtr, const char *appid)
}
for (root = root->children; root; root = root->next) {
- if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list")) {
+ if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list"))
break;
- }
}
if (!root) {
@@ -872,13 +857,11 @@ static int do_install(xmlDocPtr docPtr, const char *appid)
root = root->children; /* Jump to children node */
for (node = root; node; node = node->next) {
- if (node->type == XML_ELEMENT_NODE) {
+ if (node->type == XML_ELEMENT_NODE)
DbgPrint("Element %s\n", node->name);
- }
- if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut")) {
+ if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut"))
continue;
- }
if (!xmlHasProp(node, (xmlChar *)"extra_key") || !xmlHasProp(node, (xmlChar *)"extra_data")) {
DbgPrint("Invalid element %s\n", node->name);
@@ -997,9 +980,9 @@ static int do_install(xmlDocPtr docPtr, const char *appid)
} else {
dlist_foreach_safe(i18n_list, l, n, i18n) {
i18n_list = dlist_remove(i18n_list, l);
- if (db_insert_name(id, appid, (char *)i18n->lang, (char *)i18n->name, (char *)i18n->icon) < 0) {
+ if (db_insert_name(id, appid, (char *)i18n->lang, (char *)i18n->name, (char *)i18n->icon) < 0)
ErrPrint("Failed to add i18n name: %s(%s)\n", i18n->name, i18n->lang);
- }
+
destroy_i18n_name(i18n);
}
commit_transaction();
@@ -1019,9 +1002,8 @@ static int do_install(xmlDocPtr docPtr, const char *appid)
int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid)
{
if (!s_info.handle) {
- if (db_init() < 0) {
+ if (db_init() < 0)
return -EIO;
- }
}
do_upgrade_db_schema();
@@ -1065,9 +1047,8 @@ int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char *_appid)
}
for (root = root->children; root; root = root->next) {
- if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list")) {
+ if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list"))
break;
- }
}
if (!root) {
@@ -1078,13 +1059,11 @@ int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char *_appid)
DbgPrint("AppID: %s\n", _appid);
root = root->children;
for (node = root; node; node = node->next) {
- if (node->type == XML_ELEMENT_NODE) {
+ if (node->type == XML_ELEMENT_NODE)
DbgPrint("Element %s\n", node->name);
- }
- if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut")) {
+ if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut"))
continue;
- }
if (!xmlHasProp(node, (xmlChar *)"extra_data")
|| !xmlHasProp(node, (xmlChar *)"extra_key")
@@ -1149,19 +1128,18 @@ int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid)
int ret;
if (!s_info.handle) {
- if (db_init() < 0) {
+ if (db_init() < 0)
return -EIO;
- }
}
do_upgrade_db_schema();
begin_transaction();
ret = do_uninstall(appid);
- if (ret < 0) {
+ if (ret < 0)
ErrPrint("Failed to remove record: %s\n", appid);
/* Keep going */
- }
+
commit_transaction();
return 0;
}
@@ -1182,19 +1160,18 @@ int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid)
int ret;
if (!s_info.handle) {
- if (db_init() < 0) {
+ if (db_init() < 0)
return -EIO;
- }
}
do_upgrade_db_schema();
begin_transaction();
ret = do_uninstall(appid);
- if (ret < 0) {
+ if (ret < 0)
ErrPrint("Failed to remove a record: %s\n", appid);
/* Keep going */
- }
+
commit_transaction();
return 0;
}
diff --git a/test/application.c b/test/application.c
index dee3104..1d36ddb 100755
--- a/test/application.c
+++ b/test/application.c
@@ -21,7 +21,7 @@
static int result_cb(int ret, int pid, void *data)
{
printf("Client: Return %d (%d)\n", ret, pid);
- //elm_exit();
+ /* elm_exit(); */
return 0;
}
@@ -43,9 +43,8 @@ int elm_main(int argc, char *argv[])
Ecore_Timer *timer;
timer = ecore_timer_add(3.0f, shortcut_add_cb, NULL);
- if (!timer) {
+ if (!timer)
printf("Failed to add a timer\n");
- }
elm_run();
elm_shutdown();