diff options
author | Christopher Jeffrey <chjjeffrey@gmail.com> | 2012-09-08 21:13:56 -0500 |
---|---|---|
committer | Christopher Jeffrey <chjjeffrey@gmail.com> | 2012-09-08 21:13:56 -0500 |
commit | 4f11c53a6d948be29a69b4b3b0a40679e9dd01dd (patch) | |
tree | 5e1fe005212c04831f9195fa082a6d21afdf1a85 /compton.c | |
parent | e29714d41dabf9db6eea16583994ea061dba8505 (diff) | |
download | tdebase-4f11c53a6d948be29a69b4b3b0a40679e9dd01dd.tar.gz tdebase-4f11c53a6d948be29a69b4b3b0a40679e9dd01dd.zip |
avoid allocating a new win struct if possible
Diffstat (limited to 'compton.c')
-rw-r--r-- | compton.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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) |