code refactoring.
add a common memory fail message routine to reduce string usage.
This commit is contained in:
parent
e61cfb6124
commit
5140ab5c64
|
@ -316,7 +316,7 @@ brows_file_create(const char *file_path, Eina_Bool create_sub_file_list)
|
|||
brows_file *file = calloc(1, sizeof(brows_file));
|
||||
if (!file)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -599,7 +599,7 @@ file_browser_init(Evas_Object *parent)
|
|||
bd = calloc(1, sizeof(brows_data));
|
||||
if (!bd)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
g_bd = bd;
|
||||
|
|
|
@ -190,7 +190,7 @@ file_mgr_init(void)
|
|||
file_mgr_data *fmd = calloc(1, sizeof(file_mgr_data));
|
||||
if (!fmd)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
g_fmd = fmd;
|
||||
|
|
|
@ -39,7 +39,7 @@ Eina_Bool file_tab_it_add(Enventor_Item *enventor_it)
|
|||
fti = calloc(1, sizeof(file_tab_it));
|
||||
if (!fti)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ file_tab_init(Evas_Object *parent)
|
|||
file_data *fd = calloc(1, sizeof(file_data));
|
||||
if (!fd)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
g_fd = fd;
|
||||
|
|
|
@ -3,3 +3,8 @@
|
|||
const char *DEFAULT_EDC_FORMAT = "enventor_XXXXXX.edc";
|
||||
char EDJE_PATH[PATH_MAX];
|
||||
const char *ENVENTOR_NAME = "enventor";
|
||||
|
||||
void mem_fail_msg(void)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ goto_open(void)
|
|||
gd = calloc(1, sizeof(goto_data));
|
||||
if (!gd)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
g_gd = gd;
|
||||
|
|
|
@ -610,7 +610,7 @@ menu_init(void)
|
|||
menu_data *md = calloc(1, sizeof(menu_data));
|
||||
if (!md)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
g_md = md;
|
||||
|
|
|
@ -141,7 +141,7 @@ newfile_create(Evas_Object *parent, Evas_Smart_Cb selected_cb, void *data)
|
|||
nd = calloc(1, sizeof(new_data));
|
||||
if (!nd)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
g_nd = nd;
|
||||
|
|
|
@ -318,7 +318,7 @@ panes_init(Evas_Object *parent)
|
|||
panes_data *pd = malloc(sizeof(panes_data));
|
||||
if (!pd)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
g_pd = pd;
|
||||
|
|
|
@ -309,7 +309,7 @@ preference_setting_init(void)
|
|||
preference_setting_data *psd = calloc(1, sizeof(preference_setting_data));
|
||||
if (!psd)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
return psd;
|
||||
|
|
|
@ -334,7 +334,7 @@ search_open(void)
|
|||
sd = calloc(1, sizeof(search_data));
|
||||
if (!sd)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
g_sd = sd;
|
||||
|
|
|
@ -184,7 +184,7 @@ setting_open(void)
|
|||
sd = calloc(1, sizeof(setting_data));
|
||||
if (!sd)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
g_sd = sd;
|
||||
|
|
|
@ -309,7 +309,7 @@ stats_init(Evas_Object *parent)
|
|||
stats_data *sd = calloc(1, sizeof(stats_data));
|
||||
if (!sd)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
g_sd = sd;
|
||||
|
|
|
@ -403,7 +403,7 @@ color_keyword_list_create(char *syntax_template_str)
|
|||
sizeof(color_keyword));
|
||||
if (!color_keyword_list)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ syntax_template_format_create(text_setting_data *tsd)
|
|||
return tsd->syntax_template_format;
|
||||
|
||||
err:
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
if (utf8) free(utf8);
|
||||
|
||||
eina_file_close(file);
|
||||
|
@ -485,7 +485,8 @@ syntax_template_create(text_setting_data *tsd)
|
|||
return tsd->syntax_template_str;
|
||||
|
||||
err:
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
|
||||
if (syntax_template_format)
|
||||
{
|
||||
free(syntax_template_format);
|
||||
|
@ -994,7 +995,7 @@ text_setting_init(void)
|
|||
text_setting_data *tsd = calloc(1, sizeof(text_setting_data));
|
||||
if (!tsd)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
return tsd;
|
||||
|
|
|
@ -191,7 +191,7 @@ tools_init(Evas_Object *parent)
|
|||
td = calloc(1, sizeof(tools_data));
|
||||
if (!td)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to allocate Memory!"));
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
g_td = td;
|
||||
|
|
|
@ -2,3 +2,4 @@ extern const char *DEFAULT_EDC_FORMAT;
|
|||
extern char EDJE_PATH[PATH_MAX];
|
||||
extern Eina_Prefix *PREFIX;
|
||||
extern const char *ENVENTOR_NAME;
|
||||
void mem_fail_msg(void);
|
||||
|
|
|
@ -44,7 +44,8 @@ libenventor_la_SOURCES = \
|
|||
edj_mgr.c \
|
||||
edj_viewer.c \
|
||||
dummy_obj.c \
|
||||
outline_obj.c
|
||||
outline_obj.c \
|
||||
util.c
|
||||
|
||||
libenventor_la_CFLAGS = @ENVENTOR_CFLAGS@
|
||||
libenventor_la_LIBADD = @ENVENTOR_LIBS@
|
||||
|
|
|
@ -277,4 +277,8 @@ redoundo_data *edit_redoundo_get(edit_data *ed);
|
|||
void edit_selection_region_center_set(edit_data *ed, int start, int end);
|
||||
const char *edit_file_get(edit_data *ed);
|
||||
|
||||
|
||||
/* util */
|
||||
void mem_fail_msg(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -183,7 +183,7 @@ outline_obj_new(Evas_Object *layout)
|
|||
outline = calloc(1, sizeof(outline_obj));
|
||||
if (!outline)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ entry_changed_user_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
diff_data *diff = calloc(1, sizeof(diff_data));
|
||||
if (!diff)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ redoundo_text_push(redoundo_data *rd, const char *text, int pos, int length,
|
|||
diff_data *diff = calloc(1, sizeof(diff_data));
|
||||
if (!diff)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ redoundo_init(edit_data *ed, Enventor_Object *enventor)
|
|||
redoundo_data *rd = calloc(1, sizeof(redoundo_data));
|
||||
if (!rd)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ redoundo_text_relative_push(redoundo_data *rd, const char *text)
|
|||
diff_data *diff = malloc(sizeof(diff_data));
|
||||
if (!diff)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -696,7 +696,7 @@ color_init(Eina_Strbuf *strbuf)
|
|||
color_data *cd = calloc(1, sizeof(color_data));
|
||||
if (!cd)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ syntax_init(edit_data *ed)
|
|||
syntax_helper *sh = malloc(sizeof(syntax_helper));
|
||||
if (!sh)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
sh->strbuf = eina_strbuf_new();
|
||||
|
|
|
@ -572,7 +572,7 @@ indent_init(Eina_Strbuf *strbuf, edit_data *ed)
|
|||
indent_data *id = malloc(sizeof(indent_data));
|
||||
if (!id)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
mem_fail_msg();
|
||||
return NULL;
|
||||
}
|
||||
id->strbuf = strbuf;
|
||||
|
|
Loading…
Reference in New Issue