common.h: remove cxfree
Apparently XFree does take NULL. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
939f2fb602
commit
a409913c5f
2
src/c2.c
2
src/c2.c
@ -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
|
// Free the string after usage, if necessary
|
||||||
if (tgt_free) {
|
if (tgt_free) {
|
||||||
if (C2_L_TATOM == pleaf->type)
|
if (C2_L_TATOM == pleaf->type)
|
||||||
cxfree(tgt_free);
|
XFree(tgt_free);
|
||||||
else
|
else
|
||||||
free(tgt_free);
|
free(tgt_free);
|
||||||
}
|
}
|
||||||
|
10
src/common.h
10
src/common.h
@ -538,16 +538,6 @@ static inline struct timespec get_time_timespec(void) {
|
|||||||
return tm;
|
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.
|
* Return the painting target window.
|
||||||
*/
|
*/
|
||||||
|
@ -913,7 +913,7 @@ static bool register_cm(session_t *ps) {
|
|||||||
}
|
}
|
||||||
Xutf8SetWMProperties(ps->dpy, ps->reg_win, "compton", "compton", NULL, 0,
|
Xutf8SetWMProperties(ps->dpy, ps->reg_win, "compton", "compton", NULL, 0,
|
||||||
NULL, NULL, h);
|
NULL, NULL, h);
|
||||||
cxfree(h);
|
XFree(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set _NET_WM_PID
|
// Set _NET_WM_PID
|
||||||
|
@ -113,7 +113,7 @@ static inline XTextProperty *make_text_prop(session_t *ps, char *str) {
|
|||||||
XTextProperty *pprop = ccalloc(1, XTextProperty);
|
XTextProperty *pprop = ccalloc(1, XTextProperty);
|
||||||
|
|
||||||
if (XmbTextListToTextProperty(ps->dpy, &str, 1, XStringStyle, pprop)) {
|
if (XmbTextListToTextProperty(ps->dpy, &str, 1, XStringStyle, pprop)) {
|
||||||
cxfree(pprop->value);
|
XFree(pprop->value);
|
||||||
free(pprop);
|
free(pprop);
|
||||||
pprop = NULL;
|
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);
|
XSetTextProperty(ps->dpy, wid, pprop, prop_atom);
|
||||||
cxfree(pprop->value);
|
XFree(pprop->value);
|
||||||
cxfree(pprop);
|
XFree(pprop);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ bool glx_init(session_t *ps, bool need_render) {
|
|||||||
success = true;
|
success = true;
|
||||||
|
|
||||||
glx_init_end:
|
glx_init_end:
|
||||||
cxfree(pvis);
|
XFree(pvis);
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
glx_destroy(ps);
|
glx_destroy(ps);
|
||||||
|
@ -310,10 +310,10 @@ int win_get_name(session_t *ps, struct managed_win *w) {
|
|||||||
!nstr || !strlst) {
|
!nstr || !strlst) {
|
||||||
if (strlst)
|
if (strlst)
|
||||||
XFreeStringList(strlst);
|
XFreeStringList(strlst);
|
||||||
cxfree(text_prop.value);
|
XFree(text_prop.value);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
cxfree(text_prop.value);
|
XFree(text_prop.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
4
src/x.c
4
src/x.c
@ -100,11 +100,11 @@ bool wid_get_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop, char **
|
|||||||
*pnstr = 0;
|
*pnstr = 0;
|
||||||
if (*pstrlst)
|
if (*pstrlst)
|
||||||
XFreeStringList(*pstrlst);
|
XFreeStringList(*pstrlst);
|
||||||
cxfree(text_prop.value);
|
XFree(text_prop.value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cxfree(text_prop.value);
|
XFree(text_prop.value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user