Assume free(0) is ok (if not HAVE_FREE_NULL_BUG will have to be defined).

SVN revision: 33818
This commit is contained in:
Kim Woelders 2008-02-23 12:09:38 +00:00
parent 8380235420
commit 0a05aafc82
52 changed files with 285 additions and 487 deletions

View File

@ -243,8 +243,8 @@ while (ll) \
{ \
l = ll; \
ll = ll->next; \
free(l->name); \
free(l); \
Efree(l->name); \
Efree(l); \
}
#define UPDATE_NOW \
@ -572,7 +572,7 @@ main(int argc, char **argv)
dirlen = sp - exe;
if (dirlen > 1)
{
free(docdir);
Efree(docdir);
docdir = EMALLOC(char, dirlen + 1);
memcpy(docdir, exe, dirlen);
@ -580,8 +580,7 @@ main(int argc, char **argv)
}
GetObjects(p);
pclose(p);
if (page_hist)
free(page_hist);
Efree(page_hist);
page_hist = EMALLOC(int, 1);
page_hist[0] = 0;

View File

@ -146,9 +146,13 @@ extern Display *disp;
extern Root VRoot;
extern char *docdir;
#define Efree free
#define Emalloc malloc
#define Erealloc realloc
#if HAVE_FREE_NULL_BUG
#define Efree(p) if (p) free(p)
#else
#define Efree free
#endif
#define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))
#define EREALLOC(type, ptr, num) (type*)Erealloc(ptr, (num)*sizeof(type))

View File

@ -44,10 +44,8 @@ freestrlist(char **l, int num)
if (!l)
return;
while (num--)
if (l[num])
free(l[num]);
free(l);
return;
Efree(l[num]);
Efree(l);
}
void
@ -110,7 +108,6 @@ word(char *s, int num, char *wd)
}
*wd = 0;
}
return;
}
#ifdef USE_WORD_MB
@ -265,7 +262,6 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
}
*wd = 0;
}
return;
}
#endif
@ -294,14 +290,14 @@ findLocalizedFile(char *fname)
sprintf(fname, "%s.%s", tmp, lang);
if (exists(fname))
{
free(tmp);
free(lang);
Efree(tmp);
Efree(lang);
return 1;
}
}
strcpy(fname, tmp);
free(tmp);
free(lang);
Efree(tmp);
Efree(lang);
return 0;
}

View File

@ -423,29 +423,22 @@ GetObjects(FILE * f)
{
int j;
if (page[i].name)
free(page[i].name);
if (page[i].background)
free(page[i].background);
Efree(page[i].name);
Efree(page[i].background);
for (j = 0; j < page[i].count; j++)
{
switch (page[i].obj[j].type)
{
case IMG:
if (((Img_ *) page[i].obj[j].object)->src)
free(((Img_ *) page[i].obj[j].object)->src);
if (((Img_ *) page[i].obj[j].object)->src2)
free(((Img_ *) page[i].obj[j].object)->src2);
if (((Img_ *) page[i].obj[j].object)->src3)
free(((Img_ *) page[i].obj[j].object)->src3);
if (((Img_ *) page[i].obj[j].object)->link)
free(((Img_ *) page[i].obj[j].object)->link);
Efree(((Img_ *) page[i].obj[j].object)->src);
Efree(((Img_ *) page[i].obj[j].object)->src2);
Efree(((Img_ *) page[i].obj[j].object)->src3);
Efree(((Img_ *) page[i].obj[j].object)->link);
break;
case BR:
break;
case FONT:
if (((Font_ *) page[i].obj[j].object)->face)
free(((Font_ *) page[i].obj[j].object)->face);
Efree(((Font_ *) page[i].obj[j].object)->face);
break;
case P:
break;
@ -454,13 +447,11 @@ GetObjects(FILE * f)
case PAGE:
break;
}
if (page[i].obj[j].object)
free(page[i].obj[j].object);
Efree(page[i].obj[j].object);
}
if (page[i].obj)
free(page[i].obj);
Efree(page[i].obj);
}
free(page);
Efree(page);
num_pages = 0;
page = NULL;
have_font = 0;
@ -482,8 +473,7 @@ GetObjects(FILE * f)
{
if (!GetNextTag(&obj))
{
if (fdat)
free(fdat);
Efree(fdat);
return 0;
}
}
@ -492,8 +482,7 @@ GetObjects(FILE * f)
{
if (!GetNextTag(&obj))
{
if (fdat)
free(fdat);
Efree(fdat);
return 0;
}
}
@ -513,7 +502,7 @@ GetObjects(FILE * f)
have_font = 1;
obj.object = NULL;
}
free(fdat);
Efree(fdat);
}
int

View File

@ -91,8 +91,7 @@ TextStateLoadFont(TextState * ts)
ts->height = as + ds;
}
}
if (s2)
free(s2);
Efree(s2);
if (ts->efont)
return;
}

View File

@ -55,9 +55,13 @@ void ClientDestroy(Client * c);
void Alert(const char *fmt, ...);
#define Ecalloc calloc
#define Efree free
#define Emalloc malloc
#define Erealloc realloc
#if HAVE_FREE_NULL_BUG
#define Efree(p) if (p) free(p)
#else
#define Efree free
#endif
#define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))
#define EREALLOC(type, ptr, num) (type*)Erealloc(ptr, (num)*sizeof(type))

View File

@ -190,7 +190,6 @@ ClientDestroy(Client * c)
if (!c)
return;
if (c->msg)
Efree(c->msg);
Efree(c);
}

View File

@ -79,7 +79,6 @@ RemoveActionType(ActionType * ActionTypeToRemove)
ptr = ActionTypeToRemove;
while (ptr)
{
if (ptr->params)
Efree(ptr->params);
pp = ptr;
ptr = ptr->next;
@ -123,9 +122,7 @@ ActionDestroy(Action * aa)
UnGrabActionKey(aa);
if (aa->action)
RemoveActionType(aa->action);
if (aa->tooltipstring)
Efree(aa->tooltipstring);
if (aa->key_str)
Efree(aa->key_str);
Efree(aa);
}
@ -211,11 +208,8 @@ ActionclassDestroy(ActionClass * ac)
for (i = 0; i < ac->num; i++)
ActionDestroy(ac->list[i]);
if (ac->list)
Efree(ac->list);
if (ac->name)
Efree(ac->name);
if (ac->tooltipstring)
Efree(ac->tooltipstring);
Efree(ac);
mode_action_destroy = 1;
@ -306,8 +300,6 @@ AclassConfigLoad(FILE * fs)
(aclass_tooltipstring) ? Estrdup((aclass_tooltipstring[0]) ?
aclass_tooltipstring :
"?!?") : NULL;
_EFREE(aclass_tooltipstring);
_EFREE(action_tooltipstring);
err = 0;
goto done;
@ -457,7 +449,8 @@ AclassConfigLoad(FILE * fs)
aa = ActionCreate(event, anymod, mod, anybut, but, anykey,
key, action_tooltipstring);
/* the correct place to grab an action key */
_EFREE(action_tooltipstring);
Efree(action_tooltipstring);
action_tooltipstring = NULL;
key[0] = '\0';
if (global)
GrabActionKey(aa);
@ -482,8 +475,8 @@ AclassConfigLoad(FILE * fs)
ActionclassDestroy(ac);
done:
_EFREE(aclass_tooltipstring);
_EFREE(action_tooltipstring);
Efree(aclass_tooltipstring);
Efree(action_tooltipstring);
return err;
}

View File

@ -536,11 +536,8 @@ ShowAlert(const char *title,
}
done:
if (str1)
Efree(str1);
if (str2)
Efree(str2);
if (str3)
Efree(str3);
}

View File

@ -424,13 +424,9 @@ ArrangeRects(const RectBox * fixed, int fixed_count, RectBox * floating,
done:
/* free up memory */
if (xarray)
Efree(xarray);
if (yarray)
Efree(yarray);
if (filled)
Efree(filled);
if (spaces)
Efree(spaces);
}
@ -638,7 +634,6 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
dy = 0;
}
if (lst)
Efree(lst);
if ((odx != dx) || (ody != dy))
@ -851,9 +846,7 @@ ArrangeEwinXY(EWin * ewin, int *px, int *py)
break;
}
}
if (ret)
Efree(ret);
if (fixed)
Efree(fixed);
}
@ -918,11 +911,8 @@ ArrangeEwins(const char *params)
EwinMove(ewin, ret[i].x, ret[i].y);
}
if (fixed)
Efree(fixed);
if (ret)
Efree(ret);
if (floating)
Efree(floating);
done:

View File

@ -210,19 +210,15 @@ BackgroundImagesKeep(Background * bg, int onoff)
static void
BackgroundFilesRemove(Background * bg)
{
if (bg->bg.file)
Efree(bg->bg.file);
bg->bg.file = NULL;
if (bg->bg.real_file)
Efree(bg->bg.real_file);
bg->bg.real_file = NULL;
if (bg->top.file)
Efree(bg->top.file);
bg->top.file = NULL;
if (bg->top.real_file)
Efree(bg->top.real_file);
bg->top.real_file = NULL;
@ -249,7 +245,6 @@ BackgroundDestroy(Background * bg)
BackgroundFilesRemove(bg);
BackgroundPixmapFree(bg);
if (bg->name)
Efree(bg->name);
Efree(bg);
@ -424,7 +419,6 @@ BackgroundModify(Background * bg, EColor * solid, const char *bgn, char tile,
}
else
updated = 1;
if (bg->bg.file)
Efree(bg->bg.file);
bg->bg.file = (bgn[0]) ? Estrdup(bgn) : NULL;
if ((int)tile != bg->bg_tile)
@ -453,7 +447,6 @@ BackgroundModify(Background * bg, EColor * solid, const char *bgn, char tile,
}
else
updated = 1;
if (bg->top.file)
Efree(bg->top.file);
bg->top.file = (top[0]) ? Estrdup(top) : NULL;
if ((int)tkeep_aspect != bg->top.keep_aspect)
@ -1193,7 +1186,6 @@ BackgroundsConfigLoad(FILE * fs)
}
else
{
if (name)
Efree(name);
name = Estrdup(s2);
}
@ -1230,19 +1222,14 @@ BackgroundsConfigLoad(FILE * fs)
&i3, &i4, &i5, &i6);
if (!ignore)
{
if (bg1)
Efree(bg1);
bg1 = Estrdup(s2);
}
else
{
if (bg->bg.file)
Efree(bg->bg.file);
if (bg->top.file)
{
Efree(bg->top.file);
bg->top.file = NULL;
}
bg->bg.file = Estrdup(s2);
bg->bg_tile = i1;
bg->bg.keep_aspect = i2;
@ -1258,7 +1245,6 @@ BackgroundsConfigLoad(FILE * fs)
&j4, &j5);
if (!ignore)
{
if (bg2)
Efree(bg2);
bg2 = Estrdup(s2);
}
@ -1280,11 +1266,8 @@ BackgroundsConfigLoad(FILE * fs)
err = -1;
done:
if (name)
Efree(name);
if (bg1)
Efree(bg1);
if (bg2)
Efree(bg2);
return err;
@ -1614,7 +1597,6 @@ BG_DialogSetFileName(DItem * di)
Esnprintf(s, sizeof(s),
_("Background definition information:\nName: %s\nFile: %s\n"),
BackgroundGetName(tmp_bg), (stmp) ? stmp : _("-NONE-"));
if (stmp)
Efree(stmp);
DialogItemSetText(di, s);
}
@ -2389,7 +2371,6 @@ BackgroundSet1(const char *name, const char *params)
}
else if (!strcmp(type, "bg.file"))
{
if (bg->bg.file)
Efree(bg->bg.file);
bg->bg.file = Estrdup(p);
}
@ -2419,7 +2400,6 @@ BackgroundSet1(const char *name, const char *params)
}
else if (!strcmp(type, "top.file"))
{
if (bg->top.file)
Efree(bg->top.file);
bg->top.file = Estrdup(p);
}

View File

@ -477,7 +477,6 @@ EwinBorderDetach(EWin * ewin)
if (ewin->bits[i].win)
EDestroyWindow(ewin->bits[i].win);
}
if (ewin->bits)
Efree(ewin->bits);
ewin->bits = NULL;
BorderDecRefcount(b);
@ -647,12 +646,8 @@ BorderDestroy(Border * b)
ECursorFree(b->part[i].ec);
}
if (b->num_winparts > 0)
Efree(b->part);
if (b->name)
Efree(b->name);
if (b->group_border_name)
Efree(b->group_border_name);
ActionclassFree(b->aclass);
}

View File

@ -192,8 +192,6 @@ ButtonDestroy(Button * b)
ImageclassFree(b->iclass);
ActionclassFree(b->aclass);
TextclassFree(b->tclass);
if (b->label)
Efree(b->label);
Efree(b);

View File

@ -309,19 +309,12 @@ ColorModifierConfigLoad(FILE * fs)
err = -1;
done:
if (name)
Efree(name);
if (rx)
Efree(rx);
if (ry)
Efree(ry);
if (gx)
Efree(gx);
if (gy)
Efree(gy);
if (bx)
Efree(bx);
if (by)
Efree(by);
return err;
@ -338,17 +331,11 @@ ModifyCMClass(char *name, int rnum, unsigned char *rpx, unsigned char *rpy,
if (!cm)
return;
if (cm->red.px)
Efree(cm->red.px);
if (cm->red.py)
Efree(cm->red.py);
if (cm->green.px)
Efree(cm->green.px);
if (cm->green.py)
Efree(cm->green.py);
if (cm->blue.px)
Efree(cm->blue.px);
if (cm->blue.py)
Efree(cm->blue.py);
cm->red.px = NULL;
@ -602,17 +589,11 @@ IPC_ColormodifierSet(const char *params)
AddItem(cm, cm->name, 0, LIST_TYPE_COLORMODIFIER);
}
Efree(name);
if (rpx)
Efree(rpx);
if (rpy)
Efree(rpy);
if (gpx)
Efree(gpx);
if (gpy)
Efree(gpy);
if (bpx)
Efree(bpx);
if (bpy)
Efree(bpy);
}

View File

@ -75,16 +75,12 @@ ClientDestroy(Client * c)
ecore_list_node_remove(client_list, c);
if (c->name)
Efree(c->name);
if (c->msg)
Efree(c->msg);
if (c->clientname)
Efree(c->clientname);
if (c->version)
Efree(c->version);
if (c->info)
Efree(c->info);
Efree(c);
}
@ -101,13 +97,11 @@ ClientConfigure(Client * c, const char *str)
if (!strcmp(param, "clientname"))
{
if (c->clientname)
Efree(c->clientname);
c->clientname = Estrdup(value);
}
else if (!strcmp(param, "version"))
{
if (c->version)
Efree(c->version);
c->version = Estrdup(value);
}
@ -125,7 +119,6 @@ ClientConfigure(Client * c, const char *str)
}
else if (!strcmp(param, "info"))
{
if (c->info)
Efree(c->info);
c->info = Estrdup(value);
}

View File

@ -253,11 +253,8 @@ ConfigFilePreparse(const char *path, const char *dest)
def_shell, path, dest);
system(execline);
if (def_user)
Efree(def_user);
if (def_shell)
Efree(def_shell);
if (def_home)
Efree(def_home);
return exists(dest) ? 0 : 1;

View File

@ -173,12 +173,10 @@ ContainerDestroy(Container * ct, int exiting)
ct->ops->Exit(ct, exiting);
if (ct->name)
Efree(ct->name);
EDestroyWindow(ct->win);
if (ct->objs)
Efree(ct->objs);
Efree(ct);
@ -1547,7 +1545,6 @@ _DlgFillContainer(Dialog * d, DItem * table, void *data)
tmp_ib_cover_hide = ct->cover_hide;
tmp_ib_autoresize_anchor = ct->auto_resize_anchor;
tmp_ib_anim_mode = ct->anim_mode;
if (tmp_ib_name)
Efree(tmp_ib_name);
tmp_ib_name = Estrdup(ct->name);

View File

@ -125,10 +125,9 @@ ECursorDestroy(ECursor * ec)
ecore_list_node_remove(cursor_list, ec);
if (ec->name)
Efree(ec->name);
if (ec->file)
Efree(ec->file);
Efree(ec);
}

View File

@ -1440,7 +1440,6 @@ DeskRestack(Desk * dsk)
XRestackWindows(disp, wl, tot);
if (wl)
Efree(wl);
done:

View File

@ -232,7 +232,8 @@ DialogBindKey(Dialog * d, const char *key, DialogCallbackFunc * func, int val,
void
DialogKeybindingsDestroy(Dialog * d)
{
_EFREE(d->keybindings);
Efree(d->keybindings);
d->keybindings = NULL;
d->num_bindings = 0;
}
@ -267,9 +268,7 @@ DialogDestroy(Dialog * d)
{
ecore_list_node_remove(dialog_list, d);
if (d->name)
Efree(d->name);
if (d->title)
Efree(d->title);
DialogKeybindingsDestroy(d);
if (d->item)
@ -298,7 +297,6 @@ DialogFind(const char *name)
void
DialogSetTitle(Dialog * d, const char *title)
{
if (d->title)
Efree(d->title);
d->title = Estrdup(title);
d->set_title = 1;
@ -1439,9 +1437,7 @@ DialogRealizeItem(Dialog * d, DItem * di)
r++;
}
}
if (col_size)
Efree(col_size);
if (row_size)
Efree(row_size);
}
}
@ -1799,7 +1795,6 @@ DialogItemsRealize(Dialog * d)
void
DialogItemSetText(DItem * di, const char *text)
{
if (di->text)
Efree(di->text);
di->text = Estrdup(text);
}
@ -1876,7 +1871,6 @@ DialogItemSeparatorSetOrientation(DItem * di, char horizontal)
void
DialogItemImageSetFile(DItem * di, const char *image)
{
if (di->item.image.image)
Efree(di->item.image.image);
di->item.image.image = Estrdup(image);
di->fill_h = 0;
@ -2001,9 +1995,7 @@ DialogItemTableEmpty(DItem * di)
for (i = 0; i < di->item.table.num_items; i++)
DialogItemDestroy(di->item.table.items[i], 1);
if (di->item.table.items)
Efree(di->item.table.items);
di->item.table.items = NULL;
di->item.table.num_items = 0;
}
@ -2014,7 +2006,6 @@ DialogItemDestroy(DItem * di, int clean)
if (di->type == DITEM_TABLE)
DialogItemTableEmpty(di);
if (di->text)
Efree(di->text);
switch (di->type)
@ -2027,7 +2018,6 @@ DialogItemDestroy(DItem * di, int clean)
EDestroyWindow(di->item.check_button.check_win);
break;
case DITEM_IMAGE:
if (di->item.image.image)
Efree(di->item.image.image);
break;
case DITEM_RADIOBUTTON:

View File

@ -1822,7 +1822,8 @@ ECompMgrWinDel(EObj * eo)
REGION_DESTROY(cw->extents);
REGION_DESTROY(cw->clip);
_EFREE(eo->cmhook);
Efree(eo->cmhook);
eo->cmhook = NULL;
_ECM_SET_STACK_CHANGED();
}
@ -2392,7 +2393,6 @@ ECompMgrShadowsInit(int mode, int cleanup)
OpacityFix(Conf_compmgr.shadows.sharp.opacity, 100);
Mode_compmgr.opac_sharp = .01 * Conf_compmgr.shadows.sharp.opacity;
if (gaussianMap)
Efree(gaussianMap);
gaussianMap = NULL;

View File

@ -412,7 +412,6 @@ CfgItemSetFromString(const CfgItem * ci, const char *str)
*((float *)ci->ptr) = fval;
break;
case ITEM_TYPE_STRING:
if (*(char **)ci->ptr)
Efree(*(char **)ci->ptr);
if (*str == '\0')
str = NULL;

View File

@ -246,11 +246,8 @@ EobjFini(EObj * eo)
else
EDestroyWindow(eo->win);
if (eo->icccm.wm_name)
Efree(eo->icccm.wm_name);
if (eo->icccm.wm_res_name)
Efree(eo->icccm.wm_res_name);
if (eo->icccm.wm_res_class)
Efree(eo->icccm.wm_res_class);
}

View File

@ -419,7 +419,6 @@ doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags)
EoGetY(lst[i]) + dy, 0, 0,
flags & (MRF_DESK | MRF_MOVE |
MRF_FLOAT | MRF_UNFLOAT));
if (lst)
Efree(lst);
}
@ -588,7 +587,6 @@ EwinIconify(EWin * ewin)
if (lst && call_depth == 1)
GNOME_SetClientList();
#endif
if (lst)
Efree(lst);
EwinStateUpdate(ewin);
@ -663,7 +661,6 @@ EwinDeIconify1(EWin * ewin, int dx, int dy)
if (lst && call_depth == 1)
GNOME_SetClientList();
#endif
if (lst)
Efree(lst);
EwinStateUpdate(ewin);
@ -1308,7 +1305,6 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
EoSetLayer(lst[i], lst[i]->save_fs.layer +
EoGetLayer(ewin) - ewin->save_fs.layer);
}
if (lst)
Efree(lst);
}
@ -1334,7 +1330,6 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
lst = EwinListTransients(ewin, &num, 0);
for (i = 0; i < num; i++)
EoSetLayer(lst[i], lst[i]->save_fs.layer);
if (lst)
Efree(lst);
}
EoSetLayer(ewin, ewin->save_fs.layer);
@ -1428,7 +1423,6 @@ EwinOpClose(EWin * ewin, int source __UNUSED__)
ICCCM_Delete(gwins[i]);
SoundPlay("SOUND_WINDOW_CLOSE");
}
if (gwins)
Efree(gwins);
}
@ -1524,7 +1518,6 @@ EwinOpRaiseLower(EWin * ewin)
EwinRaise(gwins[j]);
}
if (gwins)
Efree(gwins);
}
#endif
@ -1554,7 +1547,6 @@ EwinOpStick(EWin * ewin, int source __UNUSED__, int on)
EwinStick(gwins[i]);
}
}
if (gwins)
Efree(gwins);
}
@ -1636,7 +1628,6 @@ EwinOpIconify(EWin * ewin, int source __UNUSED__, int on)
EwinIconify(gwins[i]);
}
}
if (gwins)
Efree(gwins);
}
@ -1736,7 +1727,6 @@ EwinOpSetBorder(EWin * ewin, int source __UNUSED__, const char *name)
}
SnapshotEwinUpdate(gwins[i], SNAP_USE_BORDER);
}
if (gwins)
Efree(gwins);
}

View File

@ -392,7 +392,6 @@ EwinDestroy(EWin * ewin)
if (lst[i]->icccm.transient_count < 0) /* Paranoia? */
lst[i]->icccm.transient_count = 0;
}
if (lst)
Efree(lst);
EwinCleanup(ewin);
@ -402,26 +401,18 @@ EwinDestroy(EWin * ewin)
HintsSetClientList();
if (ewin->icccm.wm_icon_name)
Efree(ewin->icccm.wm_icon_name);
if (ewin->icccm.wm_role)
Efree(ewin->icccm.wm_role);
if (ewin->icccm.wm_command)
Efree(ewin->icccm.wm_command);
if (ewin->icccm.wm_machine)
Efree(ewin->icccm.wm_machine);
if (ewin->ewmh.wm_name)
Efree(ewin->ewmh.wm_name);
if (ewin->ewmh.wm_icon_name)
Efree(ewin->ewmh.wm_icon_name);
if (ewin->ewmh.wm_icon)
Efree(ewin->ewmh.wm_icon);
if (ewin->bits)
Efree(ewin->bits);
if (ewin->session_id)
Efree(ewin->session_id);
FreePmapMask(&ewin->mini_pmm);
GroupsEwinRemove(ewin);
Efree(ewin);
}
@ -1385,7 +1376,6 @@ EwinRaise(EWin * ewin)
lst = EwinListTransients(ewin, &num, 1);
for (i = 0; i < num; i++)
EwinRaise(lst[i]);
if (lst)
Efree(lst);
if (call_depth == 1)
@ -1421,7 +1411,6 @@ EwinLower(EWin * ewin)
lst = EwinListTransientFor(ewin, &num);
for (i = 0; i < num; i++)
EwinLower(lst[i]);
if (lst)
Efree(lst);
if (call_depth == 1)

View File

@ -612,11 +612,8 @@ EWMH_GetWindowIcons(EWin * ewin)
unsigned int *val;
int num;
if (ewin->ewmh.wm_icon)
{
Efree(ewin->ewmh.wm_icon);
ewin->ewmh.wm_icon = NULL;
}
num = ecore_x_window_prop_card32_list_get(EwinGetClientXwin(ewin),
ECORE_X_ATOM_NET_WM_ICON, &val);

View File

@ -316,7 +316,6 @@ path_test(const char *file, unsigned int test)
if (file_test(s, test))
return s;
}
if (s)
Efree(s);
return NULL;
}

View File

@ -38,8 +38,9 @@ _FontAliasDestroy(void *data)
if (!fa)
return;
_EFREE(fa->name);
_EFREE(fa->font);
Efree(fa->name);
Efree(fa->font);
Efree(fa);
}

View File

@ -671,7 +671,6 @@ FX_ImageSpinner_Quit(void)
{
RemoveTimerEvent("FX_IMAGESPINNER_TIMEOUT");
XClearArea(disp, fx_imagespinner_win, 0, 0, VRoot.w, VRoot.h, False);
if (fx_imagespinner_params)
Efree(fx_imagespinner_params);
fx_imagespinner_params = NULL;
fx_imagespinner_win = None;

View File

@ -644,7 +644,6 @@ GNOME_SetDeskNames(void)
ecore_x_window_prop_string_list_set(VRoot.xwin, atom_set, names, n_desks);
for (i = 0; i < n_desks; i++)
if (names[i])
Efree(names[i]);
Efree(names);
}
@ -674,7 +673,6 @@ GNOME_SetClientList(void)
}
}
ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, wl, j);
if (wl)
Efree(wl);
}

View File

@ -102,8 +102,8 @@ GroupDestroy(Group * g)
if (g == Mode_groups.current)
Mode_groups.current = NULL;
if (g->members)
Efree(g->members);
Efree(g);
}

View File

@ -224,38 +224,34 @@ ImagestateCreate(const char *file)
}
static void
FreeImageState(ImageState * i)
ImagestateDestroy(ImageState * is)
{
if (!is)
return;
Efree(i->im_file);
Efree(i->real_file);
Efree(is->im_file);
Efree(is->real_file);
if (i->im)
{
EImageFree(i->im);
i->im = NULL;
}
if (is->im)
EImageFree(is->im);
if (i->border)
Efree(i->border);
Efree(is->border);
#if ENABLE_COLOR_MODIFIERS
if (i->colmod)
i->colmod->ref_count--;
if (is->colmod)
is->colmod->ref_count--;
#endif
Efree(is);
}
static void
FreeImageStateArray(ImageStateArray * isa)
{
FreeImageState(isa->normal);
Efree(isa->normal);
FreeImageState(isa->hilited);
Efree(isa->hilited);
FreeImageState(isa->clicked);
Efree(isa->clicked);
FreeImageState(isa->disabled);
Efree(isa->disabled);
ImagestateDestroy(isa->normal);
ImagestateDestroy(isa->hilited);
ImagestateDestroy(isa->clicked);
ImagestateDestroy(isa->disabled);
}
static void
@ -362,7 +358,6 @@ ImageclassDestroy(ImageClass * ic)
ecore_list_node_remove(iclass_list, ic);
if (ic->name)
Efree(ic->name);
FreeImageStateArray(&(ic->norm));
@ -374,6 +369,8 @@ ImageclassDestroy(ImageClass * ic)
if (ic->colmod)
ic->colmod->ref_count--;
#endif
Efree(ic);
}
ImageClass *

View File

@ -397,7 +397,6 @@ SelectIconboxForEwin(EWin * ewin)
ib_sel = ct;
}
}
if (lst)
Efree(lst);
}
@ -435,7 +434,6 @@ IconboxesUpdateEwinIcon(EWin * ewin, int icon_mode)
ct = lst[i];
IconboxUpdateEwinIcon(ct, ewin, icon_mode);
}
if (lst)
Efree(lst);
}

View File

@ -137,7 +137,6 @@ EstrInt2EncFree(const char *str, int want_utf8)
if (Mode.locale.utf8_int == want_utf8)
return;
if (str)
Efree((char *)str);
#else
str = NULL;

View File

@ -502,7 +502,6 @@ EDirRoot(void)
static void
EConfNameSet(const char *name)
{
if (Mode.conf.name)
Efree(Mode.conf.name);
Mode.conf.name = Estrdup(name);
Esetenv("ECONFNAME", Mode.conf.name);
@ -513,7 +512,6 @@ EDirUserSet(const char *dir)
{
if (!strcmp(dir, EDirUser()))
return;
if (Mode.conf.dir)
Efree(Mode.conf.dir);
Mode.conf.dir = Estrdup(dir);
}
@ -523,7 +521,6 @@ EDirUserCacheSet(const char *dir)
{
if (!strcmp(dir, EDirUser()))
return;
if (Mode.conf.cache_dir)
Efree(Mode.conf.cache_dir);
Mode.conf.cache_dir = Estrdup(dir);
}

View File

@ -130,7 +130,6 @@ StrlistFree(char **lst, int num)
if (!lst)
return;
while (num--)
if (lst[num])
Efree(lst[num]);
Efree(lst);
}

View File

@ -510,7 +510,6 @@ MenuCreateFromGnome(const char *name, Menu * parent, MenuStyle * ms,
}
if (iname)
{
if (en_name)
Efree(en_name);
}
else
@ -532,11 +531,8 @@ MenuCreateFromGnome(const char *name, Menu * parent, MenuStyle * ms,
MenuAddItem(m, mi);
}
}
if (iname)
Efree(iname);
if (exec)
Efree(exec);
if (texec)
Efree(texec);
}
}
@ -622,7 +618,6 @@ MenuCreateFromBorders(const char *name, MenuStyle * ms)
MenuAddItem(m, mi);
}
}
if (lst)
Efree(lst);
return m;

View File

@ -384,7 +384,6 @@ MenuShow(Menu * m, char noshow)
static void
MenuStyleSetName(MenuStyle * ms, const char *name)
{
if (ms->name)
Efree(ms->name);
ms->name = Estrdup(name);
}
@ -486,7 +485,6 @@ MenuSetIconSize(Menu * m, int size)
void
MenuSetData(Menu * m, char *data)
{
if (m->data)
Efree(m->data);
m->data = data;
}
@ -578,13 +576,9 @@ MenuDestroy(Menu * m)
if (m->win)
EDestroyWindow(m->win);
if (m->name)
Efree(m->name);
if (m->alias)
Efree(m->alias);
if (m->title)
Efree(m->title);
if (m->data)
Efree(m->data);
Efree(m);
@ -612,19 +606,15 @@ MenuEmpty(Menu * m, int destroying)
mi->child->ref_count--;
MenuDestroy(mi->child);
}
if (mi->text)
Efree(mi->text);
if (mi->params)
Efree(mi->params);
for (j = 0; j < 3; j++)
FreePmapMask(&(mi->pmm[j]));
if (!destroying && mi->win)
EDestroyWindow(mi->win);
ImageclassFree(mi->icon_iclass);
if (mi)
Efree(mi);
}
if (m->items)
Efree(m->items);
m->items = NULL;
m->num = 0;

View File

@ -227,7 +227,6 @@ ActionMoveSuspend(void)
DrawEwinShape(ewin, Mode_mr.mode, ewin->shape_x,
ewin->shape_y, ewin->client.w, ewin->client.h, 3, i);
}
if (lst)
Efree(lst);
EUngrabServer();
@ -279,7 +278,6 @@ ActionMoveResume(void)
DrawEwinShape(ewin, Mode_mr.mode, x, y,
ewin->client.w, ewin->client.h, fl, i);
}
if (lst)
Efree(lst);
return 0;

View File

@ -160,7 +160,6 @@ PagerDestroy(Pager * p)
ecore_list_node_remove(pager_list, p);
PagerScanCancel(p);
if (p->name)
Efree(p->name);
EDestroyWindow(p->win);
PagerHiwinHide();
@ -1378,7 +1377,6 @@ EwinGroupMove(EWin * ewin, Desk * dsk, int x, int y)
EwinOpMove(gwins[i], OPSRC_USER, EoGetX(gwins[i]) + dx,
EoGetY(gwins[i]) + dy);
}
if (gwins)
Efree(gwins);
}
@ -1524,7 +1522,6 @@ PagerHiwinHandleMouseUp(Pager * p, int px, int py, int button)
EwinIconify(gwins[i]);
}
}
if (gwins)
Efree(gwins);
}
else if (ewin2 && ewin2->props.vroot)

View File

@ -248,7 +248,6 @@ set_save_props(SmcConn smc_conn, int master_flag)
props[n++] = &priorityProp;
SmcSetProperties(smc_conn, n, props);
if (user)
Efree(user);
}
@ -386,7 +385,6 @@ ice_init(void)
SmcSaveCompleteProcMask |
SmcShutdownCancelledProcMask, &callbacks,
client_id, &sm_client_id, 4096, error_string_ret);
if (client_id)
Efree(client_id);
if (error_string_ret[0])

View File

@ -102,22 +102,15 @@ SnapshotDestroy(Snapshot * sn)
if (sn->used)
sn->used->snap = NULL;
if (sn->name)
Efree(sn->name);
if (sn->win_title)
Efree(sn->win_title);
if (sn->win_name)
Efree(sn->win_name);
if (sn->win_class)
Efree(sn->win_class);
if (sn->win_role)
Efree(sn->win_role);
if (sn->border_name)
Efree(sn->border_name);
if (sn->cmd)
Efree(sn->cmd);
if (sn->groups)
Efree(sn->groups);
Efree(sn);
}
@ -311,7 +304,6 @@ SnapshotEwinGet(EWin * ewin, unsigned int match_flags)
static void
SnapEwinBorder(Snapshot * sn, const EWin * ewin)
{
if (sn->border_name)
Efree(sn->border_name);
sn->border_name = NULL;
if (ewin->previous_border)
@ -389,7 +381,6 @@ SnapEwinCmd(Snapshot * sn, const EWin * ewin)
strcmp(ewin->icccm.wm_machine, Mode.wm.machine_name))
return;
if (sn->cmd)
Efree(sn->cmd);
sn->cmd = Estrdup(ewin->icccm.wm_command);
}
@ -406,8 +397,8 @@ SnapEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
if (!ewin->groups)
{
if (sn->groups)
Efree(sn->groups);
sn->groups = NULL;
sn->num_groups = 0;
return;
}
@ -427,9 +418,7 @@ SnapEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
sn = SnapshotEwinGet(gwins[i], SNAP_MATCH_DEFAULT);
if (sn)
{
if (sn->groups)
Efree(sn->groups);
sn->groups = EMALLOC(int, num_groups);
sn->num_groups = num_groups;
@ -447,8 +436,8 @@ SnapEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
sn = gwins[i]->snap;
if (sn)
{
if (sn->groups)
Efree(sn->groups);
sn->groups = NULL;
sn->num_groups = 0;
}
}

View File

@ -96,10 +96,9 @@ SclassDestroy(SoundClass * sclass)
ecore_list_node_remove(sound_list, sclass);
_SclassSampleDestroy(sclass, NULL);
if (sclass->name)
Efree(sclass->name);
if (sclass->file)
Efree(sclass->file);
Efree(sclass);
}

View File

@ -69,10 +69,13 @@ TextstateCreate(const char *font)
static void
TextStateDestroy(TextState * ts)
{
if (ts->fontname)
if (!ts)
return;
Efree(ts->fontname);
if (ts->ops)
ts->ops->Destroy(ts);
Efree(ts);
}
@ -104,40 +107,24 @@ TextclassDestroy(TextClass * tc)
tc->ref_count);
return;
}
if (tc->name)
Efree(tc->name);
if (tc->norm.normal)
TextStateDestroy(tc->norm.normal);
if (tc->norm.hilited)
TextStateDestroy(tc->norm.hilited);
if (tc->norm.clicked)
TextStateDestroy(tc->norm.clicked);
if (tc->norm.disabled)
TextStateDestroy(tc->norm.disabled);
if (tc->active.normal)
TextStateDestroy(tc->active.normal);
if (tc->active.hilited)
TextStateDestroy(tc->active.hilited);
if (tc->active.clicked)
TextStateDestroy(tc->active.clicked);
if (tc->active.disabled)
TextStateDestroy(tc->active.disabled);
if (tc->sticky.normal)
TextStateDestroy(tc->sticky.normal);
if (tc->sticky.hilited)
TextStateDestroy(tc->sticky.hilited);
if (tc->sticky.clicked)
TextStateDestroy(tc->sticky.clicked);
if (tc->sticky.disabled)
TextStateDestroy(tc->sticky.disabled);
if (tc->sticky_active.normal)
TextStateDestroy(tc->sticky_active.normal);
if (tc->sticky_active.hilited)
TextStateDestroy(tc->sticky_active.hilited);
if (tc->sticky_active.clicked)
TextStateDestroy(tc->sticky_active.clicked);
if (tc->sticky_active.disabled)
TextStateDestroy(tc->sticky_active.disabled);
Efree(tc);
}
@ -178,7 +165,6 @@ TextclassSetJustification(TextClass * tc, int just)
static void
TextclassPopulate(TextClass * tclass)
{
if (!tclass)
return;

View File

@ -391,7 +391,6 @@ TextstateTextFitMB(TextState * ts, char **ptext, int *pw, int textwidth_limit)
Efree(text);
*ptext = new_line;
done:
if (wc_line)
Efree(wc_line);
EwcClose();
}

View File

@ -106,9 +106,7 @@ append_merge_dir(char *dir, char ***list, int *count)
tmp2 = fileof(str[i]);
if ((tmp != NULL) && (tmp2 != NULL) && (!strcmp(tmp, tmp2)))
already = 1;
if (tmp)
Efree(tmp);
if (tmp2)
Efree(tmp2);
}
@ -421,11 +419,9 @@ ThemePathFind(void)
EDirRoot(), EDirUser());
}
if (Conf.theme.name)
Efree(Conf.theme.name);
Conf.theme.name = (theme) ? fullfileof(theme) : NULL;
if (Mode.theme.path)
Efree(Mode.theme.path);
Mode.theme.path = theme;
}

View File

@ -122,7 +122,6 @@ TimersRun(double tt)
qe->func(qe->runtime_val, qe->runtime_data);
/* free the timer */
if (qe->name)
Efree(qe->name);
Efree(qe);
}
@ -164,9 +163,7 @@ RemoveTimerEvent(const char *name)
else
q_first = qe->next;
/* free it */
if (qe->name)
Efree(qe->name);
if (qe)
Efree(qe);
/* done */
return 1;
@ -303,7 +300,6 @@ AnimatorDel(Animator * an)
#endif
ecore_list_node_remove(animator_list, an);
if (an->name)
Efree(an->name);
Efree(an);

View File

@ -661,7 +661,6 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
}
}
if (heights)
Efree(heights);
}

View File

@ -56,8 +56,12 @@
#include <stdlib.h>
#define Ecalloc calloc
#define Emalloc malloc
#define Efree free
#define Erealloc realloc
#if HAVE_FREE_NULL_BUG
#define Efree(p) if (p) free(p)
#else
#define Efree free
#endif
#define ECALLOC(type, num) (type*)Ecalloc(num, sizeof(type))
#define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))

View File

@ -281,7 +281,6 @@ WarpFocusHide(void)
if (fw && EoIsShown(fw))
WarpFocusWinHide(fw);
if (warplist)
Efree(warplist);
warplist = NULL;
warplist_num = 0;

View File

@ -123,11 +123,8 @@ WindowMatchDestroy(WindowMatch * wm)
ecore_list_node_remove(wm_list, wm);
if (wm->name)
Efree(wm->name);
if (wm->value)
Efree(wm->value);
if (wm->args)
Efree(wm->args);
Efree(wm);
@ -659,7 +656,7 @@ WindowMatchEwinOpsAction(EWin * ewin, int op, const char *args)
return;
case EWIN_OP_TITLE:
_EFREE(EwinGetIcccmName(ewin));
Efree(EwinGetIcccmName(ewin));
EwinGetIcccmName(ewin) = Estrdup(args);
break;

View File

@ -128,7 +128,6 @@ EXidDestroy(Win win)
#endif
if (win->rects)
XFree(win->rects);
if (win->cbl.lst)
Efree(win->cbl.lst);
Efree(win);
}
@ -1499,7 +1498,6 @@ EShapePropagate(Win win)
return win->num_rect;
bail_out:
if (rects)
Efree(rects);
EShapeCombineMask(win, ShapeBounding, 0, 0, None, ShapeSet);
return 0;