mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
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
7 changed files with 10 additions and 20 deletions
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
|
||||
if (tgt_free) {
|
||||
if (C2_L_TATOM == pleaf->type)
|
||||
cxfree(tgt_free);
|
||||
XFree(tgt_free);
|
||||
else
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
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;
|
||||
if (*pstrlst)
|
||||
XFreeStringList(*pstrlst);
|
||||
cxfree(text_prop.value);
|
||||
XFree(text_prop.value);
|
||||
return false;
|
||||
}
|
||||
|
||||
cxfree(text_prop.value);
|
||||
XFree(text_prop.value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue