mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
get rid of the xfree() wrapper around free(); from Tiago Cunha.
This commit is contained in:
parent
dfb6aed82a
commit
76b0874b4c
1
calmwm.h
1
calmwm.h
@ -490,7 +490,6 @@ void u_exec(char *);
|
|||||||
void u_spawn(char *);
|
void u_spawn(char *);
|
||||||
|
|
||||||
void *xcalloc(size_t, size_t);
|
void *xcalloc(size_t, size_t);
|
||||||
void xfree(void *);
|
|
||||||
void *xmalloc(size_t);
|
void *xmalloc(size_t);
|
||||||
char *xstrdup(const char *);
|
char *xstrdup(const char *);
|
||||||
|
|
||||||
|
10
client.c
10
client.c
@ -166,12 +166,12 @@ client_delete(struct client_ctx *cc)
|
|||||||
while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) {
|
while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) {
|
||||||
TAILQ_REMOVE(&cc->nameq, wn, entry);
|
TAILQ_REMOVE(&cc->nameq, wn, entry);
|
||||||
if (wn->name != emptystring)
|
if (wn->name != emptystring)
|
||||||
xfree(wn->name);
|
free(wn->name);
|
||||||
xfree(wn);
|
free(wn);
|
||||||
}
|
}
|
||||||
|
|
||||||
client_freehints(cc);
|
client_freehints(cc);
|
||||||
xfree(cc);
|
free(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -582,8 +582,8 @@ match:
|
|||||||
assert(wn != NULL);
|
assert(wn != NULL);
|
||||||
TAILQ_REMOVE(&cc->nameq, wn, entry);
|
TAILQ_REMOVE(&cc->nameq, wn, entry);
|
||||||
if (wn->name != emptystring)
|
if (wn->name != emptystring)
|
||||||
xfree(wn->name);
|
free(wn->name);
|
||||||
xfree(wn);
|
free(wn);
|
||||||
cc->nameqlen--;
|
cc->nameqlen--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
25
conf.c
25
conf.c
@ -202,36 +202,35 @@ conf_clear(struct conf *c)
|
|||||||
|
|
||||||
while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) {
|
while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) {
|
||||||
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
||||||
xfree(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((kb = TAILQ_FIRST(&c->keybindingq)) != NULL) {
|
while ((kb = TAILQ_FIRST(&c->keybindingq)) != NULL) {
|
||||||
TAILQ_REMOVE(&c->keybindingq, kb, entry);
|
TAILQ_REMOVE(&c->keybindingq, kb, entry);
|
||||||
xfree(kb);
|
free(kb);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((ag = TAILQ_FIRST(&c->autogroupq)) != NULL) {
|
while ((ag = TAILQ_FIRST(&c->autogroupq)) != NULL) {
|
||||||
TAILQ_REMOVE(&c->autogroupq, ag, entry);
|
TAILQ_REMOVE(&c->autogroupq, ag, entry);
|
||||||
xfree(ag->class);
|
free(ag->class);
|
||||||
if (ag->name)
|
free(ag->name);
|
||||||
xfree(ag->name);
|
free(ag);
|
||||||
xfree(ag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((wm = TAILQ_FIRST(&c->ignoreq)) != NULL) {
|
while ((wm = TAILQ_FIRST(&c->ignoreq)) != NULL) {
|
||||||
TAILQ_REMOVE(&c->ignoreq, wm, entry);
|
TAILQ_REMOVE(&c->ignoreq, wm, entry);
|
||||||
xfree(wm);
|
free(wm);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((mb = TAILQ_FIRST(&c->mousebindingq)) != NULL) {
|
while ((mb = TAILQ_FIRST(&c->mousebindingq)) != NULL) {
|
||||||
TAILQ_REMOVE(&c->mousebindingq, mb, entry);
|
TAILQ_REMOVE(&c->mousebindingq, mb, entry);
|
||||||
xfree(mb);
|
free(mb);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < CWM_COLOR_MAX; i++)
|
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
|
void
|
||||||
@ -477,7 +476,7 @@ conf_bindname(struct conf *c, char *name, char *binding)
|
|||||||
|
|
||||||
if (current_binding->keysym == NoSymbol &&
|
if (current_binding->keysym == NoSymbol &&
|
||||||
current_binding->keycode == 0) {
|
current_binding->keycode == 0) {
|
||||||
xfree(current_binding);
|
free(current_binding);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,7 +522,7 @@ conf_unbind(struct conf *c, struct keybinding *unbind)
|
|||||||
key->keysym == unbind->keysym) {
|
key->keysym == unbind->keysym) {
|
||||||
conf_ungrab(c, key);
|
conf_ungrab(c, key);
|
||||||
TAILQ_REMOVE(&c->keybindingq, key, entry);
|
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) {
|
if (mb->button == unbind->button) {
|
||||||
TAILQ_REMOVE(&c->mousebindingq, mb, entry);
|
TAILQ_REMOVE(&c->mousebindingq, mb, entry);
|
||||||
xfree(mb);
|
free(mb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
group.c
6
group.c
@ -129,7 +129,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XRestackWindows(X_Dpy, winlist, gc->nhidden);
|
XRestackWindows(X_Dpy, winlist, gc->nhidden);
|
||||||
xfree(winlist);
|
free(winlist);
|
||||||
|
|
||||||
gc->hidden = 0;
|
gc->hidden = 0;
|
||||||
group_setactive(sc, gc->shortcut - 1);
|
group_setactive(sc, gc->shortcut - 1);
|
||||||
@ -387,7 +387,7 @@ group_menu(XButtonEvent *e)
|
|||||||
cleanup:
|
cleanup:
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
TAILQ_REMOVE(&menuq, mi, entry);
|
TAILQ_REMOVE(&menuq, mi, entry);
|
||||||
xfree(mi);
|
free(mi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +491,7 @@ group_update_names(struct screen_ctx *sc)
|
|||||||
if (prop_ret != NULL)
|
if (prop_ret != NULL)
|
||||||
XFree(prop_ret);
|
XFree(prop_ret);
|
||||||
if (sc->group_nonames != 0)
|
if (sc->group_nonames != 0)
|
||||||
xfree(sc->group_names);
|
free(sc->group_names);
|
||||||
|
|
||||||
sc->group_names = strings;
|
sc->group_names = strings;
|
||||||
sc->group_nonames = n;
|
sc->group_nonames = n;
|
||||||
|
21
kbfunc.c
21
kbfunc.c
@ -170,7 +170,7 @@ kbfunc_client_search(struct client_ctx *cc, union arg *arg)
|
|||||||
|
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
TAILQ_REMOVE(&menuq, mi, entry);
|
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) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
TAILQ_REMOVE(&menuq, mi, entry);
|
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);
|
(void)closedir(dirp);
|
||||||
}
|
}
|
||||||
xfree(path);
|
free(path);
|
||||||
|
|
||||||
if ((mi = menu_filter(sc, &menuq, label, NULL,
|
if ((mi = menu_filter(sc, &menuq, label, NULL,
|
||||||
CWM_MENU_DUMMY | CWM_MENU_FILE,
|
CWM_MENU_DUMMY | CWM_MENU_FILE,
|
||||||
@ -319,10 +319,10 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
|
|||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
if (mi != NULL && mi->dummy)
|
if (mi != NULL && mi->dummy)
|
||||||
xfree(mi);
|
free(mi);
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
TAILQ_REMOVE(&menuq, mi, entry);
|
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));
|
(void)strlcpy(mi->text, hostbuf, sizeof(mi->text));
|
||||||
TAILQ_INSERT_TAIL(&menuq, mi, entry);
|
TAILQ_INSERT_TAIL(&menuq, mi, entry);
|
||||||
}
|
}
|
||||||
xfree(lbuf);
|
free(lbuf);
|
||||||
(void)fclose(fp);
|
(void)fclose(fp);
|
||||||
|
|
||||||
if ((mi = menu_filter(sc, &menuq, "ssh", NULL, CWM_MENU_DUMMY,
|
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:
|
out:
|
||||||
if (mi != NULL && mi->dummy)
|
if (mi != NULL && mi->dummy)
|
||||||
xfree(mi);
|
free(mi);
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
TAILQ_REMOVE(&menuq, mi, entry);
|
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);
|
search_match_text, NULL);
|
||||||
|
|
||||||
if (!mi->abort) {
|
if (!mi->abort) {
|
||||||
if (cc->label != NULL)
|
free(cc->label);
|
||||||
xfree(cc->label);
|
|
||||||
cc->label = xstrdup(mi->text);
|
cc->label = xstrdup(mi->text);
|
||||||
}
|
}
|
||||||
xfree(mi);
|
free(mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
6
menu.c
6
menu.c
@ -188,7 +188,7 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, char *prompt,
|
|||||||
out:
|
out:
|
||||||
if ((mc.flags & CWM_MENU_DUMMY) == 0 && mi->dummy) {
|
if ((mc.flags & CWM_MENU_DUMMY) == 0 && mi->dummy) {
|
||||||
/* no mouse based match */
|
/* no mouse based match */
|
||||||
xfree(mi);
|
free(mi);
|
||||||
mi = NULL;
|
mi = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ menu_complete_path(struct menu_ctx *mc)
|
|||||||
|
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
TAILQ_REMOVE(&menuq, mi, entry);
|
TAILQ_REMOVE(&menuq, mi, entry);
|
||||||
xfree(mi);
|
free(mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path[0] != '\0')
|
if (path[0] != '\0')
|
||||||
@ -233,7 +233,7 @@ menu_complete_path(struct menu_ctx *mc)
|
|||||||
mc->searchstr, path);
|
mc->searchstr, path);
|
||||||
else if (!mr->abort)
|
else if (!mr->abort)
|
||||||
strlcpy(mr->text, mc->searchstr, sizeof(mr->text));
|
strlcpy(mr->text, mc->searchstr, sizeof(mr->text));
|
||||||
xfree(path);
|
free(path);
|
||||||
return (mr);
|
return (mr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
|
|||||||
} else {
|
} else {
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
TAILQ_REMOVE(&menuq, mi, entry);
|
TAILQ_REMOVE(&menuq, mi, entry);
|
||||||
xfree(mi);
|
free(mi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -282,6 +282,6 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg)
|
|||||||
else
|
else
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
TAILQ_REMOVE(&menuq, mi, entry);
|
TAILQ_REMOVE(&menuq, mi, entry);
|
||||||
xfree(mi);
|
free(mi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,12 +52,6 @@ xcalloc(size_t no, size_t siz)
|
|||||||
return (p);
|
return (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
xfree(void *p)
|
|
||||||
{
|
|
||||||
free(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrdup(const char *str)
|
xstrdup(const char *str)
|
||||||
{
|
{
|
||||||
|
2
xutil.c
2
xutil.c
@ -339,7 +339,7 @@ xu_ewmh_net_client_list(struct screen_ctx *sc)
|
|||||||
winlist[j++] = cc->win;
|
winlist[j++] = cc->win;
|
||||||
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST].atom,
|
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST].atom,
|
||||||
XA_WINDOW, 32, PropModeReplace, (unsigned char *)winlist, i);
|
XA_WINDOW, 32, PropModeReplace, (unsigned char *)winlist, i);
|
||||||
xfree(winlist);
|
free(winlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user