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,8 +79,7 @@ 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;
Efree(pp); Efree(pp);
@ -123,10 +122,8 @@ 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); Efree(aa->key_str);
if (aa->key_str)
Efree(aa->key_str);
Efree(aa); Efree(aa);
} }
@ -211,12 +208,9 @@ 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); Efree(ac->name);
if (ac->name) Efree(ac->tooltipstring);
Efree(ac->name);
if (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,12 +536,9 @@ ShowAlert(const char *title,
} }
done: done:
if (str1) Efree(str1);
Efree(str1); Efree(str2);
if (str2) Efree(str3);
Efree(str2);
if (str3)
Efree(str3);
} }
void void

View File

@ -424,14 +424,10 @@ ArrangeRects(const RectBox * fixed, int fixed_count, RectBox * floating,
done: done:
/* free up memory */ /* free up memory */
if (xarray) Efree(xarray);
Efree(xarray); Efree(yarray);
if (yarray) Efree(filled);
Efree(yarray); Efree(spaces);
if (filled)
Efree(filled);
if (spaces)
Efree(spaces);
} }
void void
@ -638,8 +634,7 @@ 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,10 +846,8 @@ ArrangeEwinXY(EWin * ewin, int *px, int *py)
break; break;
} }
} }
if (ret) Efree(ret);
Efree(ret); Efree(fixed);
if (fixed)
Efree(fixed);
} }
void void
@ -918,12 +911,9 @@ 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); Efree(ret);
if (ret) Efree(floating);
Efree(ret);
if (floating)
Efree(floating);
done: done:
return; return;

View File

@ -210,20 +210,16 @@ 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;
BackgroundImagesFree(bg); BackgroundImagesFree(bg);
@ -249,8 +245,7 @@ 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,8 +419,7 @@ 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)
updated = 1; updated = 1;
@ -453,8 +447,7 @@ 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)
updated = 1; updated = 1;
@ -1193,8 +1186,7 @@ BackgroundsConfigLoad(FILE * fs)
} }
else else
{ {
if (name) Efree(name);
Efree(name);
name = Estrdup(s2); name = Estrdup(s2);
} }
break; break;
@ -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); Efree(bg->top.file);
if (bg->top.file) bg->top.file = NULL;
{
Efree(bg->top.file);
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,8 +1245,7 @@ BackgroundsConfigLoad(FILE * fs)
&j4, &j5); &j4, &j5);
if (!ignore) if (!ignore)
{ {
if (bg2) Efree(bg2);
Efree(bg2);
bg2 = Estrdup(s2); bg2 = Estrdup(s2);
} }
else else
@ -1280,12 +1266,9 @@ BackgroundsConfigLoad(FILE * fs)
err = -1; err = -1;
done: done:
if (name) Efree(name);
Efree(name); Efree(bg1);
if (bg1) Efree(bg2);
Efree(bg1);
if (bg2)
Efree(bg2);
return err; return err;
} }
@ -1614,8 +1597,7 @@ 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,8 +2371,7 @@ 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);
} }
else if (!strcmp(type, "bg.tile")) else if (!strcmp(type, "bg.tile"))
@ -2419,8 +2400,7 @@ 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);
} }
else if (!strcmp(type, "top.keep_aspect")) else if (!strcmp(type, "top.keep_aspect"))

View File

@ -477,8 +477,7 @@ 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,13 +646,9 @@ BorderDestroy(Border * b)
ECursorFree(b->part[i].ec); ECursorFree(b->part[i].ec);
} }
if (b->num_winparts > 0) Efree(b->part);
Efree(b->part); Efree(b->name);
Efree(b->group_border_name);
if (b->name)
Efree(b->name);
if (b->group_border_name)
Efree(b->group_border_name);
ActionclassFree(b->aclass); ActionclassFree(b->aclass);
} }

View File

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

View File

@ -309,20 +309,13 @@ ColorModifierConfigLoad(FILE * fs)
err = -1; err = -1;
done: done:
if (name) Efree(name);
Efree(name); Efree(rx);
if (rx) Efree(ry);
Efree(rx); Efree(gx);
if (ry) Efree(gy);
Efree(ry); Efree(bx);
if (gx) Efree(by);
Efree(gx);
if (gy)
Efree(gy);
if (bx)
Efree(bx);
if (by)
Efree(by);
return err; return err;
} }
@ -338,18 +331,12 @@ 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); Efree(cm->red.py);
if (cm->red.py) Efree(cm->green.px);
Efree(cm->red.py); Efree(cm->green.py);
if (cm->green.px) Efree(cm->blue.px);
Efree(cm->green.px); Efree(cm->blue.py);
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; cm->red.px = NULL;
cm->red.py = NULL; cm->red.py = NULL;
@ -602,18 +589,12 @@ 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); Efree(rpy);
if (rpy) Efree(gpx);
Efree(rpy); Efree(gpy);
if (gpx) Efree(bpx);
Efree(gpx); Efree(bpy);
if (gpy)
Efree(gpy);
if (bpx)
Efree(bpx);
if (bpy)
Efree(bpy);
} }
static const IpcItem CmClassIpcArray[] = { static const IpcItem CmClassIpcArray[] = {

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); Efree(c->msg);
if (c->msg) Efree(c->clientname);
Efree(c->msg); Efree(c->version);
if (c->clientname) Efree(c->info);
Efree(c->clientname);
if (c->version)
Efree(c->version);
if (c->info)
Efree(c->info);
Efree(c); Efree(c);
} }
@ -101,14 +97,12 @@ 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);
} }
else if (!strcmp(param, "author")) else if (!strcmp(param, "author"))
@ -125,8 +119,7 @@ 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);
} }
else if (!strcmp(param, "pixmap")) else if (!strcmp(param, "pixmap"))

View File

@ -253,12 +253,9 @@ 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); Efree(def_shell);
if (def_shell) Efree(def_home);
Efree(def_shell);
if (def_home)
Efree(def_home);
return exists(dest) ? 0 : 1; return exists(dest) ? 0 : 1;
} }

View File

@ -173,13 +173,11 @@ 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,8 +1545,7 @@ _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);
DialogSetTitle(d, ct->dlg_title); DialogSetTitle(d, ct->dlg_title);

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); Efree(ec->file);
if (ec->file)
Efree(ec->file);
Efree(ec); Efree(ec);
} }

View File

@ -1440,8 +1440,7 @@ DeskRestack(Desk * dsk)
XRestackWindows(disp, wl, tot); XRestackWindows(disp, wl, tot);
if (wl) Efree(wl);
Efree(wl);
done: done:
if (dsk->stack.update_client_list) if (dsk->stack.update_client_list)

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,10 +268,8 @@ 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); Efree(d->title);
if (d->title)
Efree(d->title);
DialogKeybindingsDestroy(d); DialogKeybindingsDestroy(d);
if (d->item) if (d->item)
DialogItemDestroy(d->item, 0); DialogItemDestroy(d->item, 0);
@ -298,8 +297,7 @@ 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,10 +1437,8 @@ DialogRealizeItem(Dialog * d, DItem * di)
r++; r++;
} }
} }
if (col_size) Efree(col_size);
Efree(col_size); Efree(row_size);
if (row_size)
Efree(row_size);
} }
} }
break; break;
@ -1799,8 +1795,7 @@ 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,8 +1871,7 @@ 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;
di->fill_v = 0; di->fill_v = 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,8 +2006,7 @@ 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,8 +2018,7 @@ 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:
if (!clean) if (!clean)

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,8 +2393,7 @@ 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;
if (mode != ECM_SHADOWS_OFF) if (mode != ECM_SHADOWS_OFF)

View File

@ -412,8 +412,7 @@ 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;
*((char **)ci->ptr) = Estrdup(str); *((char **)ci->ptr) = Estrdup(str);

View File

@ -246,12 +246,9 @@ 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); Efree(eo->icccm.wm_res_name);
if (eo->icccm.wm_res_name) Efree(eo->icccm.wm_res_class);
Efree(eo->icccm.wm_res_name);
if (eo->icccm.wm_res_class)
Efree(eo->icccm.wm_res_class);
} }
void void

View File

@ -419,8 +419,7 @@ 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);
} }
EwinDetermineArea(ewin); EwinDetermineArea(ewin);
@ -588,8 +587,7 @@ 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);
HintsSetWindowState(ewin); HintsSetWindowState(ewin);
@ -663,8 +661,7 @@ 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);
HintsSetWindowState(ewin); HintsSetWindowState(ewin);
@ -1308,8 +1305,7 @@ 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);
} }
EwinRaise(ewin); EwinRaise(ewin);
@ -1334,8 +1330,7 @@ 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,8 +1423,7 @@ 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);
} }
void void
@ -1524,8 +1518,7 @@ EwinOpRaiseLower(EWin * ewin)
EwinRaise(gwins[j]); EwinRaise(gwins[j]);
} }
if (gwins) Efree(gwins);
Efree(gwins);
} }
#endif #endif
@ -1554,8 +1547,7 @@ EwinOpStick(EWin * ewin, int source __UNUSED__, int on)
EwinStick(gwins[i]); EwinStick(gwins[i]);
} }
} }
if (gwins) Efree(gwins);
Efree(gwins);
} }
void void
@ -1636,8 +1628,7 @@ EwinOpIconify(EWin * ewin, int source __UNUSED__, int on)
EwinIconify(gwins[i]); EwinIconify(gwins[i]);
} }
} }
if (gwins) Efree(gwins);
Efree(gwins);
} }
void void
@ -1736,8 +1727,7 @@ 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);
} }
void void

View File

@ -392,8 +392,7 @@ 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);
EobjListOrderDel(&ewin->o); EobjListOrderDel(&ewin->o);
@ -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); Efree(ewin->icccm.wm_role);
if (ewin->icccm.wm_role) Efree(ewin->icccm.wm_command);
Efree(ewin->icccm.wm_role); Efree(ewin->icccm.wm_machine);
if (ewin->icccm.wm_command) Efree(ewin->ewmh.wm_name);
Efree(ewin->icccm.wm_command); Efree(ewin->ewmh.wm_icon_name);
if (ewin->icccm.wm_machine) Efree(ewin->ewmh.wm_icon);
Efree(ewin->icccm.wm_machine); Efree(ewin->bits);
if (ewin->ewmh.wm_name) Efree(ewin->session_id);
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); FreePmapMask(&ewin->mini_pmm);
GroupsEwinRemove(ewin); GroupsEwinRemove(ewin);
Efree(ewin); Efree(ewin);
} }
@ -1385,8 +1376,7 @@ 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,8 +1411,7 @@ 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);
{ ewin->ewmh.wm_icon = NULL;
Efree(ewin->ewmh.wm_icon);
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,8 +316,7 @@ 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,8 +671,7 @@ 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,8 +644,7 @@ 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,8 +673,7 @@ 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);
} }
static void static void

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,8 +358,7 @@ 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));
FreeImageStateArray(&(ic->active)); FreeImageStateArray(&(ic->active));
@ -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,8 +397,7 @@ SelectIconboxForEwin(EWin * ewin)
ib_sel = ct; ib_sel = ct;
} }
} }
if (lst) Efree(lst);
Efree(lst);
} }
return ib_sel; return ib_sel;
@ -435,8 +434,7 @@ 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);
} }
static void static void

View File

@ -137,8 +137,7 @@ 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;
want_utf8 = 0; want_utf8 = 0;

View File

@ -502,8 +502,7 @@ 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,8 +512,7 @@ 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,8 +521,7 @@ 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,8 +130,7 @@ 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,8 +510,7 @@ MenuCreateFromGnome(const char *name, Menu * parent, MenuStyle * ms,
} }
if (iname) if (iname)
{ {
if (en_name) Efree(en_name);
Efree(en_name);
} }
else else
{ {
@ -532,12 +531,9 @@ MenuCreateFromGnome(const char *name, Menu * parent, MenuStyle * ms,
MenuAddItem(m, mi); MenuAddItem(m, mi);
} }
} }
if (iname) Efree(iname);
Efree(iname); Efree(exec);
if (exec) Efree(texec);
Efree(exec);
if (texec)
Efree(texec);
} }
} }
} }
@ -622,8 +618,7 @@ 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,8 +384,7 @@ 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,8 +485,7 @@ 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,14 +576,10 @@ MenuDestroy(Menu * m)
if (m->win) if (m->win)
EDestroyWindow(m->win); EDestroyWindow(m->win);
if (m->name) Efree(m->name);
Efree(m->name); Efree(m->alias);
if (m->alias) Efree(m->title);
Efree(m->alias); Efree(m->data);
if (m->title)
Efree(m->title);
if (m->data)
Efree(m->data);
Efree(m); Efree(m);
} }
@ -612,20 +606,16 @@ 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); Efree(mi->params);
if (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;
m->sel_item = NULL; m->sel_item = NULL;

View File

@ -227,8 +227,7 @@ 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,8 +278,7 @@ 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,8 +160,7 @@ 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();
if (p->bgpmap != None) if (p->bgpmap != None)
@ -1378,8 +1377,7 @@ 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);
} }
static void static void
@ -1524,8 +1522,7 @@ 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,8 +248,7 @@ 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);
} }
/* This function is usually exclusively devoted to saving data. /* This function is usually exclusively devoted to saving data.
@ -386,8 +385,7 @@ 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])
Eprintf("While connecting to session manager: %s.", error_string_ret); Eprintf("While connecting to session manager: %s.", error_string_ret);

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); Efree(sn->win_title);
if (sn->win_title) Efree(sn->win_name);
Efree(sn->win_title); Efree(sn->win_class);
if (sn->win_name) Efree(sn->win_role);
Efree(sn->win_name); Efree(sn->border_name);
if (sn->win_class) Efree(sn->cmd);
Efree(sn->win_class); Efree(sn->groups);
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); Efree(sn);
} }
@ -311,8 +304,7 @@ 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)
sn->border_name = Estrdup(BorderGetName(ewin->previous_border)); sn->border_name = Estrdup(BorderGetName(ewin->previous_border));
@ -389,8 +381,7 @@ 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); Efree(sclass->file);
if (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)
Efree(ts->fontname); return;
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); TextStateDestroy(tc->norm.normal);
if (tc->norm.normal) TextStateDestroy(tc->norm.hilited);
TextStateDestroy(tc->norm.normal); TextStateDestroy(tc->norm.clicked);
if (tc->norm.hilited) TextStateDestroy(tc->norm.disabled);
TextStateDestroy(tc->norm.hilited); TextStateDestroy(tc->active.normal);
if (tc->norm.clicked) TextStateDestroy(tc->active.hilited);
TextStateDestroy(tc->norm.clicked); TextStateDestroy(tc->active.clicked);
if (tc->norm.disabled) TextStateDestroy(tc->active.disabled);
TextStateDestroy(tc->norm.disabled); TextStateDestroy(tc->sticky.normal);
if (tc->active.normal) TextStateDestroy(tc->sticky.hilited);
TextStateDestroy(tc->active.normal); TextStateDestroy(tc->sticky.clicked);
if (tc->active.hilited) TextStateDestroy(tc->sticky.disabled);
TextStateDestroy(tc->active.hilited); TextStateDestroy(tc->sticky_active.normal);
if (tc->active.clicked) TextStateDestroy(tc->sticky_active.hilited);
TextStateDestroy(tc->active.clicked); TextStateDestroy(tc->sticky_active.clicked);
if (tc->active.disabled) TextStateDestroy(tc->sticky_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); 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,8 +391,7 @@ 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,10 +106,8 @@ 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); Efree(tmp2);
if (tmp2)
Efree(tmp2);
} }
if (already) if (already)
@ -421,12 +419,10 @@ 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,8 +122,7 @@ 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,10 +163,8 @@ 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); Efree(qe);
if (qe)
Efree(qe);
/* done */ /* done */
return 1; return 1;
} }
@ -303,8 +300,7 @@ 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);
if (ecore_list_count(animator_list) == 0) if (ecore_list_count(animator_list) == 0)

View File

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

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,8 +281,7 @@ 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,12 +123,9 @@ 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); Efree(wm->value);
if (wm->value) Efree(wm->args);
Efree(wm->value);
if (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,8 +128,7 @@ 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,8 +1498,7 @@ 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;
} }