get rid of the xfree() wrapper around free(); from Tiago Cunha.

This commit is contained in:
okan 2012-11-07 20:34:39 +00:00
parent dfb6aed82a
commit 76b0874b4c
9 changed files with 36 additions and 45 deletions

View File

@ -490,7 +490,6 @@ void u_exec(char *);
void u_spawn(char *);
void *xcalloc(size_t, size_t);
void xfree(void *);
void *xmalloc(size_t);
char *xstrdup(const char *);

View File

@ -166,12 +166,12 @@ client_delete(struct client_ctx *cc)
while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) {
TAILQ_REMOVE(&cc->nameq, wn, entry);
if (wn->name != emptystring)
xfree(wn->name);
xfree(wn);
free(wn->name);
free(wn);
}
client_freehints(cc);
xfree(cc);
free(cc);
}
void
@ -582,8 +582,8 @@ match:
assert(wn != NULL);
TAILQ_REMOVE(&cc->nameq, wn, entry);
if (wn->name != emptystring)
xfree(wn->name);
xfree(wn);
free(wn->name);
free(wn);
cc->nameqlen--;
}
}

25
conf.c
View File

@ -202,36 +202,35 @@ conf_clear(struct conf *c)
while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) {
TAILQ_REMOVE(&c->cmdq, cmd, entry);
xfree(cmd);
free(cmd);
}
while ((kb = TAILQ_FIRST(&c->keybindingq)) != NULL) {
TAILQ_REMOVE(&c->keybindingq, kb, entry);
xfree(kb);
free(kb);
}
while ((ag = TAILQ_FIRST(&c->autogroupq)) != NULL) {
TAILQ_REMOVE(&c->autogroupq, ag, entry);
xfree(ag->class);
if (ag->name)
xfree(ag->name);
xfree(ag);
free(ag->class);
free(ag->name);
free(ag);
}
while ((wm = TAILQ_FIRST(&c->ignoreq)) != NULL) {
TAILQ_REMOVE(&c->ignoreq, wm, entry);
xfree(wm);
free(wm);
}
while ((mb = TAILQ_FIRST(&c->mousebindingq)) != NULL) {
TAILQ_REMOVE(&c->mousebindingq, mb, entry);
xfree(mb);
free(mb);
}
for (i = 0; i < CWM_COLOR_MAX; i++)
xfree(c->color[i].name);
free(c->color[i].name);
xfree(c->font);
free(c->font);
}
void
@ -477,7 +476,7 @@ conf_bindname(struct conf *c, char *name, char *binding)
if (current_binding->keysym == NoSymbol &&
current_binding->keycode == 0) {
xfree(current_binding);
free(current_binding);
return;
}
@ -523,7 +522,7 @@ conf_unbind(struct conf *c, struct keybinding *unbind)
key->keysym == unbind->keysym) {
conf_ungrab(c, key);
TAILQ_REMOVE(&c->keybindingq, key, entry);
xfree(key);
free(key);
}
}
}
@ -603,7 +602,7 @@ conf_mouseunbind(struct conf *c, struct mousebinding *unbind)
if (mb->button == unbind->button) {
TAILQ_REMOVE(&c->mousebindingq, mb, entry);
xfree(mb);
free(mb);
}
}
}

View File

@ -129,7 +129,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
}
XRestackWindows(X_Dpy, winlist, gc->nhidden);
xfree(winlist);
free(winlist);
gc->hidden = 0;
group_setactive(sc, gc->shortcut - 1);
@ -387,7 +387,7 @@ group_menu(XButtonEvent *e)
cleanup:
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
TAILQ_REMOVE(&menuq, mi, entry);
xfree(mi);
free(mi);
}
}
@ -491,7 +491,7 @@ group_update_names(struct screen_ctx *sc)
if (prop_ret != NULL)
XFree(prop_ret);
if (sc->group_nonames != 0)
xfree(sc->group_names);
free(sc->group_names);
sc->group_names = strings;
sc->group_nonames = n;

View File

@ -170,7 +170,7 @@ kbfunc_client_search(struct client_ctx *cc, union arg *arg)
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
TAILQ_REMOVE(&menuq, mi, entry);
xfree(mi);
free(mi);
}
}
@ -197,7 +197,7 @@ kbfunc_menu_search(struct client_ctx *cc, union arg *arg)
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
TAILQ_REMOVE(&menuq, mi, entry);
xfree(mi);
free(mi);
}
}
@ -297,7 +297,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
}
(void)closedir(dirp);
}
xfree(path);
free(path);
if ((mi = menu_filter(sc, &menuq, label, NULL,
CWM_MENU_DUMMY | CWM_MENU_FILE,
@ -319,10 +319,10 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
}
out:
if (mi != NULL && mi->dummy)
xfree(mi);
free(mi);
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
TAILQ_REMOVE(&menuq, mi, entry);
xfree(mi);
free(mi);
}
}
@ -375,7 +375,7 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
(void)strlcpy(mi->text, hostbuf, sizeof(mi->text));
TAILQ_INSERT_TAIL(&menuq, mi, entry);
}
xfree(lbuf);
free(lbuf);
(void)fclose(fp);
if ((mi = menu_filter(sc, &menuq, "ssh", NULL, CWM_MENU_DUMMY,
@ -389,10 +389,10 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
}
out:
if (mi != NULL && mi->dummy)
xfree(mi);
free(mi);
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
TAILQ_REMOVE(&menuq, mi, entry);
xfree(mi);
free(mi);
}
}
@ -409,11 +409,10 @@ kbfunc_client_label(struct client_ctx *cc, union arg *arg)
search_match_text, NULL);
if (!mi->abort) {
if (cc->label != NULL)
xfree(cc->label);
free(cc->label);
cc->label = xstrdup(mi->text);
}
xfree(mi);
free(mi);
}
void

6
menu.c
View File

@ -188,7 +188,7 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, char *prompt,
out:
if ((mc.flags & CWM_MENU_DUMMY) == 0 && mi->dummy) {
/* no mouse based match */
xfree(mi);
free(mi);
mi = NULL;
}
@ -225,7 +225,7 @@ menu_complete_path(struct menu_ctx *mc)
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
TAILQ_REMOVE(&menuq, mi, entry);
xfree(mi);
free(mi);
}
if (path[0] != '\0')
@ -233,7 +233,7 @@ menu_complete_path(struct menu_ctx *mc)
mc->searchstr, path);
else if (!mr->abort)
strlcpy(mr->text, mc->searchstr, sizeof(mr->text));
xfree(path);
free(path);
return (mr);
}

View File

@ -253,7 +253,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
} else {
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
TAILQ_REMOVE(&menuq, mi, entry);
xfree(mi);
free(mi);
}
}
}
@ -282,6 +282,6 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
else
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
TAILQ_REMOVE(&menuq, mi, entry);
xfree(mi);
free(mi);
}
}

View File

@ -52,12 +52,6 @@ xcalloc(size_t no, size_t siz)
return (p);
}
void
xfree(void *p)
{
free(p);
}
char *
xstrdup(const char *str)
{

View File

@ -339,7 +339,7 @@ xu_ewmh_net_client_list(struct screen_ctx *sc)
winlist[j++] = cc->win;
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST].atom,
XA_WINDOW, 32, PropModeReplace, (unsigned char *)winlist, i);
xfree(winlist);
free(winlist);
}
void