enventor: Add log messages for memory allocation error

Summary: Add log messages for memory allocation error

Reviewers: Hermet

Differential Revision: https://phab.enlightenment.org/D1245
This commit is contained in:
Jaehyun Cho 2014-07-28 13:40:58 +09:00 committed by ChunEon Park
parent 9505d24711
commit 93f2148e43
19 changed files with 139 additions and 7 deletions

View File

@ -6,3 +6,4 @@ Ryuan Choi <ryuan.choi@gmail.com>
Jihoon Kim <jihoon48.kim@samsung.com>
The Rasterman (Carsten Haitzler) <raster@rasterman.com>
Kateryna Fesyna <k.fesyna@samsung.com>
JaeHyun Jo <jae_hyun_cho@naver.com>

View File

@ -484,6 +484,11 @@ void
autocomp_init(Evas_Object *parent)
{
autocomp_data *ad = calloc(1, sizeof(autocomp_data));
if (!ad)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return;
}
ad->init_thread = ecore_thread_run(init_thread_cb, init_thread_end_cb,
init_thread_cancel_cb, ad);
ad->anchor = elm_button_add(parent);

View File

@ -128,6 +128,11 @@ base_gui_init()
char buf[PATH_MAX];
base_data *bd = calloc(1, sizeof(base_data));
if (!bd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return EINA_FALSE;
}
g_bd = bd;
//Window

View File

@ -122,7 +122,11 @@ config_load()
if (!cd)
{
cd = calloc(1, sizeof(config_data));
if (!cd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
cd->font_size = 1.0f;
cd->view_scale = 1;
cd->stats_bar = EINA_TRUE;

View File

@ -244,7 +244,11 @@ ctxpopup_candidate_list_create(edit_data *ed, attr_value *attr,
//ctxpopup data
ctxpopup_data *ctxdata = malloc(sizeof(ctxpopup_data));
if (!ctxdata) goto err;
if (!ctxdata)
{
EINA_LOG_ERR("Failed to allocate Memory!");
goto err;
}
ctxdata->selected_cb = ctxpopup_selected_cb;
ctxdata->data = ed;
evas_object_data_set(ctxpopup, "ctxpopup_data", ctxdata);
@ -330,7 +334,11 @@ ctxpopup_img_preview_create(edit_data *ed,
ELM_CTXPOPUP_DIRECTION_RIGHT);
//ctxpopup data
ctxpopup_data *ctxdata = malloc(sizeof(ctxpopup_data));
if (!ctxdata) return NULL;
if (!ctxdata)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
ctxdata->relay_cb = ctxpopup_relay_cb;
ctxdata->data = ed;
ctxdata->ctxpopup = ctxpopup;

View File

@ -68,7 +68,11 @@ dummy_objs_update(dummy_obj *dummy)
continue;
po = malloc(sizeof(part_obj));
if (!po) continue;
if (!po)
{
EINA_LOG_ERR("Failed to allocate Memory!");
continue;
}
//New part. Add fake object.
Evas_Object *obj = edje_object_add(dummy->layout);
@ -115,6 +119,11 @@ dummy_obj_new(Evas_Object *layout)
if (dummy) return;
dummy = calloc(1, sizeof(dummy_obj));
if (!dummy)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return;
}
Ecore_Animator *animator = ecore_animator_add(animator_cb, dummy);
evas_object_data_set(layout, DUMMYOBJ, dummy);

View File

@ -205,6 +205,11 @@ syntax_color_full_update(edit_data *ed, Eina_Bool thread)
if (thread)
{
syntax_color_td *td = malloc(sizeof(syntax_color_td));
if (!td)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return;
}
td->ed = ed;
Evas_Object *tb = elm_entry_textblock_get(ed->en_edit);
td->text = (char *) evas_object_textblock_text_markup_get(tb);
@ -916,6 +921,11 @@ edit_init(Evas_Object *parent)
syntax_helper *sh = syntax_init();
edit_data *ed = calloc(1, sizeof(edit_data));
if (!ed)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
ed->pd = pd;
ed->sh = sh;

View File

@ -725,7 +725,11 @@ parser_cur_group_name_get(parser_data *pd, Evas_Object *entry,
if (pd->thread) ecore_thread_cancel(pd->thread);
cur_name_td *td = calloc(1, sizeof(cur_name_td));
if (!td) return;
if (!td)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return;
}
const char *text = elm_entry_entry_get(entry);
if (!text) return;
@ -753,7 +757,11 @@ parser_cur_name_get(parser_data *pd, Evas_Object *entry, void (*cb)(void *data,
if (pd->thread) ecore_thread_cancel(pd->thread);
cur_name_td *td = calloc(1, sizeof(cur_name_td));
if (!td) return;
if (!td)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return;
}
const char *text = elm_entry_entry_get(entry);
if (!text) return;
@ -854,8 +862,20 @@ parser_data *
parser_init()
{
parser_data *pd = calloc(1, sizeof(parser_data));
if (!pd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
type_init_td *td = calloc(1, sizeof(type_init_td));
if (!td)
{
EINA_LOG_ERR("Failed to allocate Memory!");
free(pd);
return NULL;
}
td->pd = pd;
pd->init_thread = ecore_thread_run(type_init_thread_blocking,
type_init_thread_end,

View File

@ -62,6 +62,11 @@ void
edj_mgr_init(Evas_Object *parent)
{
edj_mgr *em = calloc(1, sizeof(edj_mgr));
if (!em)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return;
}
g_em = em;
Evas_Object *layout = elm_layout_add(parent);
@ -114,7 +119,11 @@ edj_mgr_view_new(const char *group)
edj_mgr *em = g_em;
edj_data *edj = calloc(1, sizeof(edj_data));
if (!edj) return NULL;
if (!edj)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
view_data *vd = view_init(em->layout, group, view_del_cb, edj);
if (!vd)

View File

@ -271,6 +271,11 @@ view_init(Evas_Object *parent, const char *group,
void (*del_cb)(void *data), void *data)
{
view_data *vd = calloc(1, sizeof(view_data));
if (!vd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
vd->parent = parent;
vd->scroller = view_scroller_create(parent);
vd->dummy_on = config_dummy_swallow_get();

View File

@ -94,6 +94,11 @@ goto_open(edit_data *ed)
search_close();
gd = calloc(1, sizeof(goto_data));
if (!gd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return;
}
g_gd = gd;
//Win

View File

@ -11,6 +11,11 @@ indent_data *
indent_init(Eina_Strbuf *strbuf)
{
indent_data *id = malloc(sizeof(indent_data));
if (!id)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
id->strbuf = strbuf;
return id;
}

View File

@ -1067,6 +1067,11 @@ void
menu_init(edit_data *ed)
{
menu_data *md = calloc(1, sizeof(menu_data));
if (!md)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return;
}
g_md = md;
md->ed = ed;

View File

@ -114,6 +114,11 @@ newfile_create(Evas_Object *parent, Evas_Smart_Cb selected_cb, void *data)
if (!nd)
{
nd = calloc(1, sizeof(new_data));
if (!nd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
g_nd = nd;
}

View File

@ -142,6 +142,11 @@ Evas_Object *
panes_init(Evas_Object *parent)
{
panes_data *pd = malloc(sizeof(panes_data));
if (!pd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
g_pd = pd;
//Panes

View File

@ -314,6 +314,11 @@ search_open(edit_data *ed)
goto_close();
sd = calloc(1, sizeof(search_data));
if (!sd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return;
}
g_sd = sd;
//Win

View File

@ -39,6 +39,11 @@ Evas_Object *
stats_init(Evas_Object *parent)
{
stats_data *sd = calloc(1, sizeof(stats_data));
if (!sd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
g_sd = sd;
Evas_Object *layout = elm_layout_add(parent);

View File

@ -141,6 +141,11 @@ color_table_init(color_data *cd)
}
tuple = malloc(sizeof(color_tuple));
if (!tuple)
{
EINA_LOG_ERR("Failed to allocate Memory!");
continue;
}
tuple->col = cd->cols[i];
tuple->key = eina_stringshare_add(key);
//free(key);
@ -174,6 +179,12 @@ macro_key_push(color_data *cd, char *str, int len)
}
color_tuple *tuple = malloc(sizeof(color_tuple));
if (!tuple)
{
EINA_LOG_ERR("Failed to allocate Memory!");
if (cut) free(key);
return;
}
tuple->col = cd->col_macro;
tuple->key = eina_stringshare_add(key);
eina_inarray_push(inarray, tuple);
@ -201,6 +212,11 @@ color_data *
color_init(Eina_Strbuf *strbuf)
{
color_data *cd = malloc(sizeof(color_data));
if (!cd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
cd->strbuf = strbuf;
cd->cachebuf = eina_strbuf_new();
cd->thread = ecore_thread_run(init_thread_blocking, NULL, NULL, cd);

View File

@ -27,6 +27,11 @@ syntax_helper *
syntax_init()
{
syntax_helper *sh = malloc(sizeof(syntax_helper));
if (!sh)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
sh->strbuf = eina_strbuf_new();
sh->buf_flush_timer = ecore_timer_add(1800, buf_flush_timer_cb, sh);