forked from enlightenment/efl
elm: Removed unnecessary null check for free.
This commit is contained in:
parent
0d1ac0fa05
commit
5353aa863c
|
@ -397,7 +397,7 @@ _elm_fileselector_entry_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
{
|
||||
Elm_Fileselector_Entry_Smart_Data *sd = _pd;
|
||||
|
||||
if (sd->path) free(sd->path);
|
||||
free(sd->path);
|
||||
|
||||
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ _path_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
|||
const char **ret = va_arg(*list, const char **);
|
||||
Elm_Fileselector_Entry_Smart_Data *sd = _pd;
|
||||
|
||||
if (sd->path) free(sd->path);
|
||||
free(sd->path);
|
||||
sd->path = elm_entry_markup_to_utf8(elm_object_text_get(sd->entry));
|
||||
*ret = sd->path;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ _access_action_callback_call(Evas_Object *obj,
|
|||
if (a && (a->fn[type].cb))
|
||||
ret = a->fn[type].cb(a->fn[type].user_data, obj, action_info);
|
||||
|
||||
if (ai) free(ai);
|
||||
free(ai);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ _elm_access_read(Elm_Access_Info *ac, int type, const Evas_Object *obj)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (txt) free(txt);
|
||||
free(txt);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -1118,7 +1118,7 @@ _elm_access_object_unregister(Evas_Object *obj, Evas_Object *hoverobj)
|
|||
Action_Info *a;
|
||||
a = evas_object_data_get(obj, "_elm_access_action_info");
|
||||
evas_object_data_del(obj, "_elm_access_action_info");
|
||||
if (a) free(a);
|
||||
free(a);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -936,7 +936,7 @@ _x11_notify_handler_uri(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *
|
|||
cnp_debug("Couldn't find a file\n");
|
||||
return 0;
|
||||
}
|
||||
if (savedtypes.imgfile) free(savedtypes.imgfile);
|
||||
free(savedtypes.imgfile);
|
||||
if (savedtypes.textreq)
|
||||
{
|
||||
savedtypes.textreq = 0;
|
||||
|
@ -1270,7 +1270,7 @@ _x11_dnd_enter(void *data EINA_UNUSED, int etype EINA_UNUSED, void *ev)
|
|||
|
||||
cnp_debug("Types\n");
|
||||
savedtypes.ntypes = enter->num_types;
|
||||
if (savedtypes.types) free(savedtypes.types);
|
||||
free(savedtypes.types);
|
||||
savedtypes.types = malloc(sizeof(char *) * enter->num_types);
|
||||
if (!savedtypes.types) return EINA_FALSE;
|
||||
|
||||
|
@ -1284,8 +1284,7 @@ _x11_dnd_enter(void *data EINA_UNUSED, int etype EINA_UNUSED, void *ev)
|
|||
/* Request it, so we know what it is */
|
||||
cnp_debug("Sending uri request\n");
|
||||
savedtypes.textreq = 1;
|
||||
if (savedtypes.imgfile) free(savedtypes.imgfile);
|
||||
savedtypes.imgfile = NULL;
|
||||
ELM_SAFE_FREE(savedtypes.imgfile, free);
|
||||
ecore_x_selection_xdnd_request(enter->win, text_uri);
|
||||
}
|
||||
}
|
||||
|
@ -2303,7 +2302,7 @@ _wl_elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Form
|
|||
|
||||
ecore_wl_dnd_selection_set(ecore_wl_input_get(), types);
|
||||
|
||||
if (sel->selbuf) free(sel->selbuf);
|
||||
free(sel->selbuf);
|
||||
sel->buflen = buflen;
|
||||
sel->selbuf = strdup((char*)selbuf);
|
||||
|
||||
|
@ -2658,8 +2657,7 @@ _wl_elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format,
|
|||
{
|
||||
drops = eina_list_remove(drops, dropable);
|
||||
eo_do(obj, eo_base_data_del("__elm_dropable"));
|
||||
free(dropable);
|
||||
dropable = NULL;
|
||||
ELM_SAFE_FREE(dropable, free);
|
||||
evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL,
|
||||
_all_drop_targets_cbs_del);
|
||||
}
|
||||
|
@ -2708,7 +2706,7 @@ _wl_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format EINA_UNUSED, const ch
|
|||
ecore_wl_dnd_drag_types_set(ecore_wl_input_get(), types);
|
||||
|
||||
/* set the drag data used when a drop occurs */
|
||||
if (wl_cnp_selection.selbuf) free(wl_cnp_selection.selbuf);
|
||||
free(wl_cnp_selection.selbuf);
|
||||
wl_cnp_selection.selbuf = strdup((char*)data);
|
||||
wl_cnp_selection.buflen = strlen(wl_cnp_selection.selbuf);
|
||||
|
||||
|
@ -2801,7 +2799,7 @@ _wl_dnd_enter(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|||
if ((!ev->num_types) || (!ev->types)) return ECORE_CALLBACK_PASS_ON;
|
||||
|
||||
savedtypes.ntypes = ev->num_types;
|
||||
if (savedtypes.types) free(savedtypes.types);
|
||||
free(savedtypes.types);
|
||||
savedtypes.types = malloc(sizeof(char *) * ev->num_types);
|
||||
if (!savedtypes.types) return EINA_FALSE;
|
||||
|
||||
|
@ -2811,8 +2809,7 @@ _wl_dnd_enter(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|||
if (savedtypes.types[i] == text_uri)
|
||||
{
|
||||
savedtypes.textreq = 1;
|
||||
if (savedtypes.imgfile) free(savedtypes.imgfile);
|
||||
savedtypes.imgfile = NULL;
|
||||
ELM_SAFE_FREE(savedtypes.imgfile, free);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3376,8 +3373,7 @@ _local_elm_cnp_selection_set(Evas_Object *obj EINA_UNUSED,
|
|||
const void *selbuf, size_t buflen)
|
||||
{
|
||||
_local_elm_cnp_init();
|
||||
if (_local_selinfo[selection].sel.buf)
|
||||
free(_local_selinfo[selection].sel.buf);
|
||||
free(_local_selinfo[selection].sel.buf);
|
||||
_local_selinfo[selection].format = format;
|
||||
_local_selinfo[selection].sel.buf = malloc(buflen + 1);
|
||||
if (_local_selinfo[selection].sel.buf)
|
||||
|
@ -3407,9 +3403,7 @@ _local_elm_object_cnp_selection_clear(Evas_Object *obj EINA_UNUSED,
|
|||
Elm_Sel_Type selection)
|
||||
{
|
||||
_local_elm_cnp_init();
|
||||
if (_local_selinfo[selection].sel.buf)
|
||||
free(_local_selinfo[selection].sel.buf);
|
||||
_local_selinfo[selection].sel.buf = NULL;
|
||||
ELM_SAFE_FREE(_local_selinfo[selection].sel.buf, free);
|
||||
_local_selinfo[selection].sel.size = 0;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ _prop_change_delay_cb(void *data EINA_UNUSED)
|
|||
s = ecore_x_window_prop_string_get(_config_win, _atom[ATOM_E_PROFILE]);
|
||||
if (s)
|
||||
{
|
||||
if (_elm_profile) free(_elm_profile);
|
||||
free(_elm_profile);
|
||||
_elm_profile = s;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -923,8 +923,7 @@ _elm_dbus_menu_unregister(Eo *obj)
|
|||
ecore_idler_del(sd->dbus_menu->signal_idler);
|
||||
|
||||
eina_hash_free(sd->dbus_menu->elements);
|
||||
free(sd->dbus_menu);
|
||||
sd->dbus_menu = NULL;
|
||||
ELM_SAFE_FREE(sd->dbus_menu, free);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -121,8 +121,7 @@ _file_load(const char *file)
|
|||
|
||||
if (eina_file_map_faulted(f, tmp))
|
||||
{
|
||||
free(text);
|
||||
text = NULL;
|
||||
ELM_SAFE_FREE(text, free);
|
||||
}
|
||||
|
||||
on_error:
|
||||
|
@ -347,7 +346,7 @@ _filter_free(Elm_Entry_Markup_Filter *tf)
|
|||
{
|
||||
Elm_Entry_Filter_Limit_Size *lim = tf->data;
|
||||
|
||||
if (lim) free(lim);
|
||||
free(lim);
|
||||
}
|
||||
else if (tf->func == elm_entry_filter_accept_set)
|
||||
{
|
||||
|
@ -2566,19 +2565,16 @@ _chars_add_till_limit(Evas_Object *obj,
|
|||
unit_size = strlen(utfstr);
|
||||
else if (unit == LENGTH_UNIT_CHAR)
|
||||
unit_size = evas_string_char_len_get(utfstr);
|
||||
free(utfstr);
|
||||
utfstr = NULL;
|
||||
ELM_SAFE_FREE(utfstr, free);
|
||||
}
|
||||
free(markup);
|
||||
markup = NULL;
|
||||
ELM_SAFE_FREE(markup, free);
|
||||
}
|
||||
if (can_add < unit_size)
|
||||
{
|
||||
if (!i)
|
||||
{
|
||||
evas_object_smart_callback_call(obj, SIG_MAX_LENGTH, NULL);
|
||||
free(*text);
|
||||
*text = NULL;
|
||||
ELM_SAFE_FREE(*text, free);
|
||||
return;
|
||||
}
|
||||
can_add = 0;
|
||||
|
@ -2750,8 +2746,7 @@ _elm_entry_smart_text_set(Eo *obj, void *_pd, va_list *list)
|
|||
if (sd->append_text_idler)
|
||||
{
|
||||
ecore_idler_del(sd->append_text_idler);
|
||||
free(sd->append_text_left);
|
||||
sd->append_text_left = NULL;
|
||||
ELM_SAFE_FREE(sd->append_text_left, free);
|
||||
sd->append_text_idler = NULL;
|
||||
}
|
||||
|
||||
|
@ -3410,8 +3405,7 @@ _elm_entry_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
if (sd->append_text_idler)
|
||||
{
|
||||
ecore_idler_del(sd->append_text_idler);
|
||||
free(sd->append_text_left);
|
||||
sd->append_text_left = NULL;
|
||||
ELM_SAFE_FREE(sd->append_text_left, free);
|
||||
sd->append_text_idler = NULL;
|
||||
}
|
||||
ecore_timer_del(sd->longpress_timer);
|
||||
|
@ -4700,8 +4694,7 @@ elm_entry_filter_limit_size(void *data,
|
|||
if ((len >= lim->max_char_count) && (newlen > 0))
|
||||
{
|
||||
evas_object_smart_callback_call(entry, SIG_MAX_LENGTH, NULL);
|
||||
free(*text);
|
||||
*text = NULL;
|
||||
ELM_SAFE_FREE(*text, free);
|
||||
free(current);
|
||||
free(utfstr);
|
||||
return;
|
||||
|
@ -4717,8 +4710,7 @@ elm_entry_filter_limit_size(void *data,
|
|||
if ((len >= lim->max_byte_count) && (newlen > 0))
|
||||
{
|
||||
evas_object_smart_callback_call(entry, SIG_MAX_LENGTH, NULL);
|
||||
free(*text);
|
||||
*text = NULL;
|
||||
ELM_SAFE_FREE(*text, free);
|
||||
free(current);
|
||||
free(utfstr);
|
||||
return;
|
||||
|
@ -5507,8 +5499,7 @@ _input_panel_imdata_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
|||
int len = va_arg(*list, int);
|
||||
Elm_Entry_Smart_Data *sd = _pd;
|
||||
|
||||
if (sd->input_panel_imdata)
|
||||
free(sd->input_panel_imdata);
|
||||
free(sd->input_panel_imdata);
|
||||
|
||||
sd->input_panel_imdata = calloc(1, len);
|
||||
sd->input_panel_imdata_len = len;
|
||||
|
|
|
@ -679,8 +679,7 @@ _state_update(Evas_Object *obj)
|
|||
sd->slices2 = calloc(sd->slices_w * sd->slices_h, sizeof(Slice *));
|
||||
if (!sd->slices2)
|
||||
{
|
||||
free(sd->slices);
|
||||
sd->slices = NULL;
|
||||
ELM_SAFE_FREE(sd->slices, free);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -919,7 +919,7 @@ _elm_image_smart_download_done(void *data, Elm_Url *url EINA_UNUSED, Eina_Binbuf
|
|||
size_t length;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
|
||||
if (sd->remote_data) free(sd->remote_data);
|
||||
free(sd->remote_data);
|
||||
length = eina_binbuf_length_get(download);
|
||||
sd->remote_data = eina_binbuf_string_steal(download);
|
||||
f = eina_file_virtualize(_elm_url_get(url),
|
||||
|
@ -1409,7 +1409,7 @@ _elm_image_smart_orient_set(Eo *obj, void *_pd, va_list *list)
|
|||
default:
|
||||
ERR("unknown orient %d", orient);
|
||||
evas_object_image_data_set(sd->img, data); // give it back
|
||||
if (data2) free(data2);
|
||||
free(data2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1425,7 +1425,7 @@ _elm_image_smart_orient_set(Eo *obj, void *_pd, va_list *list)
|
|||
}
|
||||
to += hw;
|
||||
}
|
||||
if (data2) free(data2);
|
||||
free(data2);
|
||||
|
||||
evas_object_image_data_set(sd->img, data);
|
||||
evas_object_image_data_update_add(sd->img, 0, 0, iw, ih);
|
||||
|
|
|
@ -836,10 +836,7 @@ elm_quicklaunch_prepare(int argc,
|
|||
strcat(p, exename);
|
||||
strcat(p, LIBEXT);
|
||||
if (access(exe2, R_OK | X_OK) != 0)
|
||||
{
|
||||
free(exe2);
|
||||
exe2 = NULL;
|
||||
}
|
||||
ELM_SAFE_FREE(exe2, free);
|
||||
|
||||
/* Try linking to executable first. Works with PIE files. */
|
||||
qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
|
||||
|
@ -944,8 +941,7 @@ elm_quicklaunch_fork(int argc,
|
|||
|
||||
if (quicklaunch_on)
|
||||
{
|
||||
if (_elm_appname) free(_elm_appname);
|
||||
_elm_appname = NULL;
|
||||
ELM_SAFE_FREE(_elm_appname, free);
|
||||
if ((argv) && (argv[0]))
|
||||
_elm_appname = strdup(ecore_file_file_get(argv[0]));
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ _nominatim_url_cb(const Evas_Object *obj,
|
|||
|
||||
if (str)
|
||||
{
|
||||
if (str[0]) free(str[0]);
|
||||
free(str[0]);
|
||||
free(str);
|
||||
}
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ _grid_item_create(Grid *g,
|
|||
}
|
||||
else eina_stringshare_replace(&gi->url, url);
|
||||
|
||||
if (url) free(url);
|
||||
free(url);
|
||||
eina_matrixsparse_data_idx_set(g->grid, y, x, gi);
|
||||
|
||||
return gi;
|
||||
|
@ -3130,7 +3130,7 @@ _name_request(const Evas_Object *obj,
|
|||
&(name->job), sd->ua) || !(name->job))
|
||||
{
|
||||
ERR("Can't request Name from %s to %s", url, name->fname);
|
||||
if (name->address) free(name->address);
|
||||
free(name->address);
|
||||
free(name->fname);
|
||||
free(name);
|
||||
free(fname);
|
||||
|
@ -4797,10 +4797,10 @@ _route_add(Eo *obj, void *_pd, va_list *list)
|
|||
if (!url)
|
||||
{
|
||||
ERR("Route URL is NULL");
|
||||
if (type_name) free(type_name);
|
||||
free(type_name);
|
||||
return;
|
||||
}
|
||||
if (type_name) free(type_name);
|
||||
free(type_name);
|
||||
|
||||
route = ELM_NEW(Elm_Map_Route);
|
||||
route->wsd = sd;
|
||||
|
@ -4939,8 +4939,8 @@ elm_map_name_del(Elm_Map_Name *name)
|
|||
EINA_SAFETY_ON_NULL_RETURN(name->wsd);
|
||||
ELM_MAP_CHECK((name->wsd)->obj);
|
||||
|
||||
if (name->job) ecore_file_download_abort(name->job);
|
||||
if (name->address) free(name->address);
|
||||
ecore_file_download_abort(name->job);
|
||||
free(name->address);
|
||||
if (name->fname)
|
||||
{
|
||||
ecore_file_remove(name->fname);
|
||||
|
|
|
@ -513,8 +513,7 @@ _grid_clear(Evas_Object *obj,
|
|||
}
|
||||
}
|
||||
|
||||
free(g->grid);
|
||||
g->grid = NULL;
|
||||
ELM_SAFE_FREE(g->grid, free);
|
||||
g->gw = 0;
|
||||
g->gh = 0;
|
||||
}
|
||||
|
@ -1404,7 +1403,7 @@ _elm_photocam_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
|
||||
EINA_LIST_FREE(sd->grids, g)
|
||||
{
|
||||
if (g->grid) free(g->grid);
|
||||
free(g->grid);
|
||||
free(g);
|
||||
}
|
||||
eo_unref(sd->pan_obj);
|
||||
|
@ -1556,7 +1555,7 @@ _elm_photocam_download_done(void *data, Elm_Url *url EINA_UNUSED, Eina_Binbuf *d
|
|||
size_t length;
|
||||
Evas_Load_Error ret = EVAS_LOAD_ERROR_NONE;
|
||||
|
||||
if (sd->remote_data) free(sd->remote_data);
|
||||
free(sd->remote_data);
|
||||
length = eina_binbuf_length_get(download);
|
||||
sd->remote_data = eina_binbuf_string_steal(download);
|
||||
f = eina_file_virtualize(_elm_url_get(url),
|
||||
|
|
|
@ -299,8 +299,7 @@ _eet_data_load(Elm_Prefs_Data *prefs_data,
|
|||
default:
|
||||
ERR("bad item (type = %d) fetched from data file %s, skipping it",
|
||||
it->type, prefs_data->data_file);
|
||||
free(item);
|
||||
item = NULL;
|
||||
ELM_SAFE_FREE(item, free);
|
||||
skip = EINA_TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -311,8 +310,7 @@ _eet_data_load(Elm_Prefs_Data *prefs_data,
|
|||
skip = EINA_TRUE;
|
||||
|
||||
if (set_err) eina_value_flush(&(item->value));
|
||||
free(item);
|
||||
item = NULL;
|
||||
ELM_SAFE_FREE(item, free);
|
||||
}
|
||||
|
||||
if (!skip) eina_hash_set(map, it->name, item);
|
||||
|
|
|
@ -399,7 +399,7 @@ _store_filesystem_list_do(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (info->base.sort_id) free(info->base.sort_id);
|
||||
free(info->base.sort_id);
|
||||
free(info);
|
||||
}
|
||||
if (ecore_thread_check(th)) break;
|
||||
|
@ -469,7 +469,7 @@ _store_filesystem_list_update(void *data, Ecore_Thread *th EINA_UNUSED, void *ms
|
|||
NULL/* func data */);
|
||||
st->items = eina_inlist_append(st->items, (Eina_Inlist *)sti);
|
||||
done:
|
||||
if (info->base.sort_id) free(info->base.sort_id);
|
||||
free(info->base.sort_id);
|
||||
free(info);
|
||||
}
|
||||
|
||||
|
|
|
@ -118,10 +118,9 @@ _transit_obj_data_update(Elm_Transit *transit, Evas_Object *obj)
|
|||
|
||||
obj_data->freeze_events = evas_object_freeze_events_get(obj);
|
||||
|
||||
if ((!transit->state_keep) && (obj_data->state))
|
||||
if (!transit->state_keep)
|
||||
{
|
||||
free(obj_data->state);
|
||||
obj_data->state = NULL;
|
||||
ELM_SAFE_FREE(obj_data->state, free);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -172,8 +171,7 @@ _transit_obj_remove_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *
|
|||
Elm_Transit_Obj_Data *obj_data = evas_object_data_get(obj, _transit_key);
|
||||
if (obj_data)
|
||||
{
|
||||
if (obj_data->state)
|
||||
free(obj_data->state);
|
||||
free(obj_data->state);
|
||||
free(obj_data);
|
||||
}
|
||||
_remove_obj_from_list(transit, obj);
|
||||
|
|
|
@ -3946,8 +3946,7 @@ _part_text_translatable_set(Eina_Inlist **translate_strings, const char *part, E
|
|||
eina_stringshare_del(ts->id);
|
||||
eina_stringshare_del(ts->domain);
|
||||
eina_stringshare_del(ts->string);
|
||||
free(ts);
|
||||
ts = NULL;
|
||||
ELM_SAFE_FREE(ts, free);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -491,8 +491,8 @@ _shot_do(Elm_Win_Smart_Data *sd)
|
|||
file, key, flags);
|
||||
}
|
||||
free(file);
|
||||
if (key) free(key);
|
||||
if (flags) free(flags);
|
||||
free(key);
|
||||
free(flags);
|
||||
ecore_evas_free(ee);
|
||||
if (sd->shot.repeat_count) sd->shot.shot_counter++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue