{
MGR_APP_BEGIN();
- ret_if(pkg_type == NULL);
- ret_if(data == NULL);
+ ret_if(pkg_type == NULL || data == NULL);
+
struct ug_data *ugd = (struct ug_data*)data;
mgr_app_app_info_t *app_info = NULL;
Elm_Object_Item *item = NULL;
+ char *letter_new = NULL;
+ char *letter = NULL;
int i = 0;
ret_if(mgr_app_view_app_list.view_common_data == NULL);
app_info = (mgr_app_app_info_t*)elm_object_item_data_get(item);
if (!app_info) {
MGR_APP_DEBUG_ERR("app_info is null");
- MGR_APP_MEM_FREE(app_info_new);
- return;
+ goto end;
}
int len = 0;
Elm_Object_Item *prev_item = elm_genlist_item_prev_get(item);
Elm_Object_Item *new_item = elm_genlist_item_insert_before(app_list_view_data->genlist, itc, (void*)app_info_new, NULL, item, ELM_GENLIST_ITEM_NONE, _gl_sel, (void*)ugd);
- ret_if(new_item == NULL);
+ if (!new_item) {
+ MGR_APP_DEBUG_ERR("new_item is null");
+ goto end;
+ }
- char *letter_new = __convert_char_to_string(app_info_new->app_name[0]);
- ret_if(letter_new == NULL);
- char *letter = __convert_char_to_string(app_info->app_name[0]);
+ letter_new = __convert_char_to_string(app_info_new->app_name[0]);
+ if (!letter_new) {
+ MGR_APP_DEBUG_ERR("letter_new is null");
+ goto end;
+ }
+ letter = __convert_char_to_string(app_info->app_name[0]);
if (!letter) {
- MGR_APP_MEM_FREE(letter_new);
- return;
+ MGR_APP_DEBUG_ERR("letter is null");
+ goto end;
}
/* the top of item */
mgr_app_app_info_t *app_info_prev = elm_object_item_data_get(prev_item);
if (!app_info_prev) {
- MGR_APP_MEM_FREE(letter);
- MGR_APP_MEM_FREE(letter_new);
- return;
+ MGR_APP_DEBUG_ERR("app_info_prev is null");
+ goto end;
}
char *letter_prev = __convert_char_to_string(app_info_prev->app_name[0]);
if (!letter_prev) {
- MGR_APP_MEM_FREE(letter);
- return;
+ MGR_APP_DEBUG_ERR("letter_prev is null");
+ goto end;
}
if (letter_prev[0] == letter_new[0]) {
item = elm_genlist_item_next_get(item);
if (!item) {
MGR_APP_DEBUG_ERR("item is null");
- MGR_APP_MEM_FREE(app_info_new);
- return;
+ goto end;
}
/* check the item and append after last item */
if (item == elm_genlist_last_item_get(app_list_view_data->genlist)) {
- char *letter_new = __convert_char_to_string(app_info_new->app_name[0]);
+ letter_new = __convert_char_to_string(app_info_new->app_name[0]);
if (!letter_new) {
- MGR_APP_MEM_FREE(app_info_new);
- return;
+ MGR_APP_DEBUG_ERR("letter_new is null");
+ goto end;
}
Elm_Object_Item *new_item = elm_genlist_item_append(app_list_view_data->genlist, itc, (void*)app_info_new, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, (void*)ugd);
- ret_if(new_item == NULL);
+ if (!new_item) {
+ MGR_APP_DEBUG_ERR("new_item is null");
+ goto end;
+ }
__register_index_item(app_list_view_data->index, letter_new, new_item, EINA_FALSE);
- MGR_APP_MEM_FREE(letter_new);
app_list_view_data->app_info_idx++;
break;
}
/* There are no installed app in list */
} else {
- char *letter_new = NULL;
Elm_Object_Item *new_item = NULL;
elm_genlist_item_append(app_list_view_data->genlist, itc_sep, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
letter_new = __convert_char_to_string(app_info_new->app_name[0]);
- ret_if(letter_new == NULL);
-
+ if (!letter_new) {
+ MGR_APP_DEBUG_ERR("letter_new is null");
+ goto end;
+ }
+
new_item = elm_genlist_item_append(app_list_view_data->genlist, itc, (void*)app_info_new, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel, (void*)ugd);
- ret_if(new_item == NULL);
+ if (!new_item) {
+ MGR_APP_DEBUG_ERR("new_item is null");
+ goto end;
+ }
elm_genlist_item_append(app_list_view_data->genlist, itc_sep, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_realized_items_update(app_list_view_data->genlist);
+end:
+ MGR_APP_MEM_FREE(letter);
+ MGR_APP_MEM_FREE(letter_new);
+ MGR_APP_MEM_FREE(app_info_new);
+
MGR_APP_END();
}
ret_if(data == NULL);
Elm_Object_Item *item = (Elm_Object_Item*)data;
Elm_Object_Item *next_item = elm_genlist_item_next_get(item);
+ char *next_letter = NULL;
ret_if(mgr_app_view_app_list.view_common_data == NULL);
mgr_app_view_common_data_t *view_common_data = mgr_app_view_app_list.view_common_data;
mgr_app_app_info_t *next_app_info = (mgr_app_app_info_t*)elm_object_item_data_get(next_item);
ret_if(next_app_info == NULL);
- char *next_letter = __convert_char_to_string(next_app_info->app_name[0]);
- ret_if(next_letter == NULL);
-
ret_if(event_info == NULL);
Elm_Object_Item *index_item = (Elm_Object_Item*)event_info;
+ next_letter = __convert_char_to_string(next_app_info->app_name[0]);
+ ret_if(next_letter == NULL);
+
const char *letter = elm_index_item_letter_get(index_item);
if (!letter) {
- MGR_APP_MEM_FREE(next_letter);
- return;
+ MGR_APP_DEBUG_ERR("letter is null.");
+ goto end;
}
Elm_Object_Item *prev_item = elm_genlist_item_prev_get(item);
} else {
mgr_app_app_info_t *prev_app_info = (mgr_app_app_info_t*)elm_object_item_data_get(prev_item);
if (!prev_app_info) {
- MGR_APP_MEM_FREE(next_letter);
- return;
+ MGR_APP_DEBUG_ERR("prev_app_info is null.");
+ goto end;
}
char *prev_letter = __convert_char_to_string(prev_app_info->app_name[0]);
if (!prev_letter) {
- MGR_APP_MEM_FREE(next_letter);
- return;
+ MGR_APP_DEBUG_ERR("prev_letter is null.");
+ goto end;
}
/* case: A-B'-B-B'', del:B */
}
app_list_view_data->index_cnt--;
+
+end:
+ MGR_APP_MEM_FREE(next_letter);
+
MGR_APP_END();
}