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

View File

@ -146,9 +146,13 @@ extern Display *disp;
extern Root VRoot; extern Root VRoot;
extern char *docdir; extern char *docdir;
#define Efree free
#define Emalloc malloc #define Emalloc malloc
#define Erealloc realloc #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 EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))
#define EREALLOC(type, ptr, num) (type*)Erealloc(ptr, (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) if (!l)
return; return;
while (num--) while (num--)
if (l[num]) Efree(l[num]);
free(l[num]); Efree(l);
free(l);
return;
} }
void void
@ -110,7 +108,6 @@ word(char *s, int num, char *wd)
} }
*wd = 0; *wd = 0;
} }
return;
} }
#ifdef USE_WORD_MB #ifdef USE_WORD_MB
@ -265,7 +262,6 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
} }
*wd = 0; *wd = 0;
} }
return;
} }
#endif #endif
@ -294,14 +290,14 @@ findLocalizedFile(char *fname)
sprintf(fname, "%s.%s", tmp, lang); sprintf(fname, "%s.%s", tmp, lang);
if (exists(fname)) if (exists(fname))
{ {
free(tmp); Efree(tmp);
free(lang); Efree(lang);
return 1; return 1;
} }
} }
strcpy(fname, tmp); strcpy(fname, tmp);
free(tmp); Efree(tmp);
free(lang); Efree(lang);
return 0; return 0;
} }

View File

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

View File

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

View File

@ -55,9 +55,13 @@ void ClientDestroy(Client * c);
void Alert(const char *fmt, ...); void Alert(const char *fmt, ...);
#define Ecalloc calloc #define Ecalloc calloc
#define Efree free
#define Emalloc malloc #define Emalloc malloc
#define Erealloc realloc #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 EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))
#define EREALLOC(type, ptr, num) (type*)Erealloc(ptr, (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) if (!c)
return; return;
if (c->msg)
Efree(c->msg); Efree(c->msg);
Efree(c); Efree(c);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -246,11 +246,8 @@ EobjFini(EObj * eo)
else else
EDestroyWindow(eo->win); EDestroyWindow(eo->win);
if (eo->icccm.wm_name)
Efree(eo->icccm.wm_name); Efree(eo->icccm.wm_name);
if (eo->icccm.wm_res_name)
Efree(eo->icccm.wm_res_name); Efree(eo->icccm.wm_res_name);
if (eo->icccm.wm_res_class)
Efree(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, EoGetY(lst[i]) + dy, 0, 0,
flags & (MRF_DESK | MRF_MOVE | flags & (MRF_DESK | MRF_MOVE |
MRF_FLOAT | MRF_UNFLOAT)); MRF_FLOAT | MRF_UNFLOAT));
if (lst)
Efree(lst); Efree(lst);
} }
@ -588,7 +587,6 @@ EwinIconify(EWin * ewin)
if (lst && call_depth == 1) if (lst && call_depth == 1)
GNOME_SetClientList(); GNOME_SetClientList();
#endif #endif
if (lst)
Efree(lst); Efree(lst);
EwinStateUpdate(ewin); EwinStateUpdate(ewin);
@ -663,7 +661,6 @@ EwinDeIconify1(EWin * ewin, int dx, int dy)
if (lst && call_depth == 1) if (lst && call_depth == 1)
GNOME_SetClientList(); GNOME_SetClientList();
#endif #endif
if (lst)
Efree(lst); Efree(lst);
EwinStateUpdate(ewin); EwinStateUpdate(ewin);
@ -1308,7 +1305,6 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
EoSetLayer(lst[i], lst[i]->save_fs.layer + EoSetLayer(lst[i], lst[i]->save_fs.layer +
EoGetLayer(ewin) - ewin->save_fs.layer); EoGetLayer(ewin) - ewin->save_fs.layer);
} }
if (lst)
Efree(lst); Efree(lst);
} }
@ -1334,7 +1330,6 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
lst = EwinListTransients(ewin, &num, 0); lst = EwinListTransients(ewin, &num, 0);
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
EoSetLayer(lst[i], lst[i]->save_fs.layer); EoSetLayer(lst[i], lst[i]->save_fs.layer);
if (lst)
Efree(lst); Efree(lst);
} }
EoSetLayer(ewin, ewin->save_fs.layer); EoSetLayer(ewin, ewin->save_fs.layer);
@ -1428,7 +1423,6 @@ EwinOpClose(EWin * ewin, int source __UNUSED__)
ICCCM_Delete(gwins[i]); ICCCM_Delete(gwins[i]);
SoundPlay("SOUND_WINDOW_CLOSE"); SoundPlay("SOUND_WINDOW_CLOSE");
} }
if (gwins)
Efree(gwins); Efree(gwins);
} }
@ -1524,7 +1518,6 @@ EwinOpRaiseLower(EWin * ewin)
EwinRaise(gwins[j]); EwinRaise(gwins[j]);
} }
if (gwins)
Efree(gwins); Efree(gwins);
} }
#endif #endif
@ -1554,7 +1547,6 @@ EwinOpStick(EWin * ewin, int source __UNUSED__, int on)
EwinStick(gwins[i]); EwinStick(gwins[i]);
} }
} }
if (gwins)
Efree(gwins); Efree(gwins);
} }
@ -1636,7 +1628,6 @@ EwinOpIconify(EWin * ewin, int source __UNUSED__, int on)
EwinIconify(gwins[i]); EwinIconify(gwins[i]);
} }
} }
if (gwins)
Efree(gwins); Efree(gwins);
} }
@ -1736,7 +1727,6 @@ EwinOpSetBorder(EWin * ewin, int source __UNUSED__, const char *name)
} }
SnapshotEwinUpdate(gwins[i], SNAP_USE_BORDER); SnapshotEwinUpdate(gwins[i], SNAP_USE_BORDER);
} }
if (gwins)
Efree(gwins); Efree(gwins);
} }

View File

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

View File

@ -612,11 +612,8 @@ EWMH_GetWindowIcons(EWin * ewin)
unsigned int *val; unsigned int *val;
int num; int num;
if (ewin->ewmh.wm_icon)
{
Efree(ewin->ewmh.wm_icon); Efree(ewin->ewmh.wm_icon);
ewin->ewmh.wm_icon = NULL; ewin->ewmh.wm_icon = NULL;
}
num = ecore_x_window_prop_card32_list_get(EwinGetClientXwin(ewin), num = ecore_x_window_prop_card32_list_get(EwinGetClientXwin(ewin),
ECORE_X_ATOM_NET_WM_ICON, &val); 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)) if (file_test(s, test))
return s; return s;
} }
if (s)
Efree(s); Efree(s);
return NULL; return NULL;
} }

View File

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

View File

@ -671,7 +671,6 @@ FX_ImageSpinner_Quit(void)
{ {
RemoveTimerEvent("FX_IMAGESPINNER_TIMEOUT"); RemoveTimerEvent("FX_IMAGESPINNER_TIMEOUT");
XClearArea(disp, fx_imagespinner_win, 0, 0, VRoot.w, VRoot.h, False); XClearArea(disp, fx_imagespinner_win, 0, 0, VRoot.w, VRoot.h, False);
if (fx_imagespinner_params)
Efree(fx_imagespinner_params); Efree(fx_imagespinner_params);
fx_imagespinner_params = NULL; fx_imagespinner_params = NULL;
fx_imagespinner_win = None; 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); ecore_x_window_prop_string_list_set(VRoot.xwin, atom_set, names, n_desks);
for (i = 0; i < n_desks; i++) for (i = 0; i < n_desks; i++)
if (names[i])
Efree(names[i]); Efree(names[i]);
Efree(names); Efree(names);
} }
@ -674,7 +673,6 @@ GNOME_SetClientList(void)
} }
} }
ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, wl, j); ecore_x_window_prop_card32_set(VRoot.xwin, atom_set, wl, j);
if (wl)
Efree(wl); Efree(wl);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,8 +56,12 @@
#include <stdlib.h> #include <stdlib.h>
#define Ecalloc calloc #define Ecalloc calloc
#define Emalloc malloc #define Emalloc malloc
#define Efree free
#define Erealloc realloc #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 ECALLOC(type, num) (type*)Ecalloc(num, sizeof(type))
#define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type)) #define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type))

View File

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

View File

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

View File

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