JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
argh delete some stupid debug poop
[spectrwm.git] / scrotwm.c
index 6ae2fc0..5b00d29 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -1914,8 +1914,9 @@ focus_win(struct ws_win *win)
        else {
                /* use larger hammer since the window was killed somehow */
                TAILQ_FOREACH(cfw, &win->ws->winlist, entry)
-                       XSetWindowBorder(display, cfw->id,
-                           cfw->ws->r->s->c[SWM_S_COLOR_UNFOCUS].color);
+                       if (cfw->ws && cfw->ws->r && cfw->ws->r->s)
+                               XSetWindowBorder(display, cfw->id,
+                                   cfw->ws->r->s->c[SWM_S_COLOR_UNFOCUS].color);
        }
 
        win->ws->focus = win;
@@ -2379,7 +2380,7 @@ stack_config(struct swm_region *r, union arg *args)
        if (ws->cur_layout->l_config != NULL)
                ws->cur_layout->l_config(ws, args->id);
 
-       if (args->id != SWM_ARG_ID_STACKINIT);
+       if (args->id != SWM_ARG_ID_STACKINIT)
                stack();
 }
 
@@ -3834,8 +3835,9 @@ setconfspawn(char *selector, char *value, int flags)
                        cp += (long)strspn(cp, " \t");
                if (strlen(word) > 0) {
                        prog->argc++;
-                       prog->argv = realloc(prog->argv,
-                           prog->argc * sizeof(char *));
+                       if ((prog->argv = realloc(prog->argv,
+                           prog->argc * sizeof(char *))) == NULL)
+                               err(1, "setconfspawn: realloc");
                        if ((prog->argv[prog->argc - 1] = strdup(word)) == NULL)
                                err(1, "setconfspawn: strdup");
                }
@@ -3982,7 +3984,7 @@ setkeybinding(unsigned int mod, KeySym ks, enum keyfuncid kfid,
                keys_size = 4;
                DNPRINTF(SWM_D_KEY, "setkeybinding: init list %d\n", keys_size);
                keys = malloc((size_t)keys_size * sizeof(struct key));
-               if (!keys) {
+               if (keys == NULL) {
                        fprintf(stderr, "malloc failed\n");
                        perror(" failed");
                        quit(NULL, NULL);
@@ -3991,7 +3993,7 @@ setkeybinding(unsigned int mod, KeySym ks, enum keyfuncid kfid,
                keys_size *= 2;
                DNPRINTF(SWM_D_KEY, "setkeybinding: grow list %d\n", keys_size);
                keys = realloc(keys, (size_t)keys_size * sizeof(struct key));
-               if (!keys) {
+               if (keys == NULL) {
                        fprintf(stderr, "realloc failed\n");
                        perror(" failed");
                        quit(NULL, NULL);
@@ -4007,7 +4009,7 @@ setkeybinding(unsigned int mod, KeySym ks, enum keyfuncid kfid,
                keys[j].spawn_name = strdupsafe(spawn_name);
        } else {
                fprintf(stderr, "keys array problem?\n");
-               if (!keys) {
+               if (keys == NULL) {
                        fprintf(stderr, "keys array problem\n");
                        quit(NULL, NULL);
                }
@@ -4285,7 +4287,7 @@ setquirk(const char *class, const char *name, const int quirk)
                quirks_size = 4;
                DNPRINTF(SWM_D_QUIRK, "setquirk: init list %d\n", quirks_size);
                quirks = malloc((size_t)quirks_size * sizeof(struct quirk));
-               if (!quirks) {
+               if (quirks == NULL) {
                        fprintf(stderr, "setquirk: malloc failed\n");
                        perror(" failed");
                        quit(NULL, NULL);
@@ -4295,7 +4297,7 @@ setquirk(const char *class, const char *name, const int quirk)
                DNPRINTF(SWM_D_QUIRK, "setquirk: grow list %d\n", quirks_size);
                quirks = realloc(quirks,
                    (size_t)quirks_size * sizeof(struct quirk));
-               if (!quirks) {
+               if (quirks == NULL) {
                        fprintf(stderr, "setquirk: realloc failed\n");
                        perror(" failed");
                        quit(NULL, NULL);
@@ -4309,7 +4311,7 @@ setquirk(const char *class, const char *name, const int quirk)
                quirks[j].quirk = quirk;
        } else {
                fprintf(stderr, "quirks array problem?\n");
-               if (!quirks) {
+               if (quirks == NULL) {
                        fprintf(stderr, "quirks array problem!\n");
                        quit(NULL, NULL);
                }