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 9170b573b5
commit 1e3fec4362
9 changed files with 45 additions and 54 deletions

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: calmwm.h,v 1.157 2012/11/07 14:40:51 okan Exp $
* $OpenBSD: calmwm.h,v 1.158 2012/11/07 20:34:39 okan Exp $
*/
#ifndef _CALMWM_H_
@ -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

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: client.c,v 1.101 2012/09/09 19:47:47 okan Exp $
* $OpenBSD: client.c,v 1.102 2012/11/07 20:34:39 okan Exp $
*/
#include <sys/param.h>
@ -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--;
}
}

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: conf.c,v 1.102 2012/10/31 22:06:24 okan Exp $
* $OpenBSD: conf.c,v 1.103 2012/11/07 20:34:39 okan Exp $
*/
#include <sys/param.h>
@ -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

@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: group.c,v 1.60 2012/09/09 20:52:57 okan Exp $
* $OpenBSD: group.c,v 1.61 2012/11/07 20:34:39 okan Exp $
*/
#include <sys/param.h>
@ -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

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: kbfunc.c,v 1.66 2012/11/07 14:49:46 okan Exp $
* $OpenBSD: kbfunc.c,v 1.67 2012/11/07 20:34:39 okan Exp $
*/
#include <sys/param.h>
@ -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

View File

@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: menu.c,v 1.42 2012/11/07 14:39:44 okan Exp $
* $OpenBSD: menu.c,v 1.43 2012/11/07 20:34:39 okan Exp $
*/
#include <sys/param.h>
@ -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

@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: mousefunc.c,v 1.38 2012/09/09 19:47:47 okan Exp $
* $OpenBSD: mousefunc.c,v 1.39 2012/11/07 20:34:39 okan Exp $
*/
#include <sys/param.h>
@ -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

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: xmalloc.c,v 1.7 2011/05/11 13:53:51 okan Exp $
* $OpenBSD: xmalloc.c,v 1.8 2012/11/07 20:34:39 okan Exp $
*/
#include <sys/param.h>
@ -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

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: xutil.c,v 1.46 2012/10/31 19:30:19 okan Exp $
* $OpenBSD: xutil.c,v 1.47 2012/11/07 20:34:39 okan Exp $
*/
#include <sys/param.h>
@ -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