common.h: remove cxfree

Apparently XFree does take NULL.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-05-06 01:41:36 +01:00
parent 939f2fb602
commit a409913c5f
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
7 changed files with 10 additions and 20 deletions

View File

@ -1455,7 +1455,7 @@ static inline void c2_match_once_leaf(session_t *ps, const struct managed_win *w
// Free the string after usage, if necessary
if (tgt_free) {
if (C2_L_TATOM == pleaf->type)
cxfree(tgt_free);
XFree(tgt_free);
else
free(tgt_free);
}

View File

@ -538,16 +538,6 @@ static inline struct timespec get_time_timespec(void) {
return tm;
}
/**
* Wrapper of XFree() for convenience.
*
* Because a NULL pointer cannot be passed to XFree(), its man page says.
*/
static inline void cxfree(void *data) {
if (data)
XFree(data);
}
/**
* Return the painting target window.
*/

View File

@ -913,7 +913,7 @@ static bool register_cm(session_t *ps) {
}
Xutf8SetWMProperties(ps->dpy, ps->reg_win, "compton", "compton", NULL, 0,
NULL, NULL, h);
cxfree(h);
XFree(h);
}
// Set _NET_WM_PID

View File

@ -113,7 +113,7 @@ static inline XTextProperty *make_text_prop(session_t *ps, char *str) {
XTextProperty *pprop = ccalloc(1, XTextProperty);
if (XmbTextListToTextProperty(ps->dpy, &str, 1, XStringStyle, pprop)) {
cxfree(pprop->value);
XFree(pprop->value);
free(pprop);
pprop = NULL;
}
@ -133,8 +133,8 @@ wid_set_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop_atom, char *s
}
XSetTextProperty(ps->dpy, wid, pprop, prop_atom);
cxfree(pprop->value);
cxfree(pprop);
XFree(pprop->value);
XFree(pprop);
return true;
}

View File

@ -197,7 +197,7 @@ bool glx_init(session_t *ps, bool need_render) {
success = true;
glx_init_end:
cxfree(pvis);
XFree(pvis);
if (!success)
glx_destroy(ps);

View File

@ -310,10 +310,10 @@ int win_get_name(session_t *ps, struct managed_win *w) {
!nstr || !strlst) {
if (strlst)
XFreeStringList(strlst);
cxfree(text_prop.value);
XFree(text_prop.value);
return -1;
}
cxfree(text_prop.value);
XFree(text_prop.value);
}
int ret = 0;

View File

@ -100,11 +100,11 @@ bool wid_get_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop, char **
*pnstr = 0;
if (*pstrlst)
XFreeStringList(*pstrlst);
cxfree(text_prop.value);
XFree(text_prop.value);
return false;
}
cxfree(text_prop.value);
XFree(text_prop.value);
return true;
}