summaryrefslogtreecommitdiffstats
path: root/compton.c
diff options
context:
space:
mode:
authorChristopher Jeffrey <chjjeffrey@gmail.com>2012-09-08 21:13:56 -0500
committerChristopher Jeffrey <chjjeffrey@gmail.com>2012-09-08 21:13:56 -0500
commit4f11c53a6d948be29a69b4b3b0a40679e9dd01dd (patch)
tree5e1fe005212c04831f9195fa082a6d21afdf1a85 /compton.c
parente29714d41dabf9db6eea16583994ea061dba8505 (diff)
downloadtdebase-4f11c53a6d948be29a69b4b3b0a40679e9dd01dd.tar.gz
tdebase-4f11c53a6d948be29a69b4b3b0a40679e9dd01dd.zip
avoid allocating a new win struct if possible
Diffstat (limited to 'compton.c')
-rw-r--r--compton.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/compton.c b/compton.c
index 021174804..b72dc59bd 100644
--- a/compton.c
+++ b/compton.c
@@ -1573,16 +1573,15 @@ set_opacity(Display *dpy, win *w, unsigned long opacity) {
static void
add_win(Display *dpy, Window id, Window prev, Bool override_redirect) {
+ if (find_win(dpy, id)) {
+ return;
+ }
+
win *new = malloc(sizeof(win));
win **p;
if (!new) return;
- if (find_win(dpy, id)) {
- free(new);
- return;
- }
-
if (prev) {
for (p = &list; *p; p = &(*p)->next) {
if ((*p)->id == prev && !(*p)->destroyed)