diff options
author | okan <okan> | 2015-06-28 19:50:46 +0000 |
---|---|---|
committer | okan <okan> | 2015-06-28 19:50:46 +0000 |
commit | 17720de4abd818ec04447f255e3d670ed2929911 (patch) | |
tree | 869aea4c66d55dd1480922d340a77b7c48b5f932 | |
parent | 18f63629fdb322e2bd9d39972bf28c3bc96d0942 (diff) | |
download | cwm-17720de4abd818ec04447f255e3d670ed2929911.tar.gz cwm-17720de4abd818ec04447f255e3d670ed2929911.tar.xz cwm-17720de4abd818ec04447f255e3d670ed2929911.zip |
replace assert usage
-rw-r--r-- | client.c | 5 | ||||
-rw-r--r-- | group.c | 5 | ||||
-rw-r--r-- | search.c | 4 |
3 files changed, 6 insertions, 8 deletions
diff --git a/client.c b/client.c index d38d671..c4765af 100644 --- a/client.c +++ b/client.c @@ -21,7 +21,6 @@ #include <sys/types.h> #include <sys/queue.h> -#include <assert.h> #include <err.h> #include <errno.h> #include <limits.h> @@ -635,8 +634,8 @@ match: /* Now, do some garbage collection. */ if (cc->nameqlen > CLIENT_MAXNAMEQLEN) { - wn = TAILQ_FIRST(&cc->nameq); - assert(wn != NULL); + if ((wn = TAILQ_FIRST(&cc->nameq)) == NULL) + errx(1, "client_setname: window name queue empty"); TAILQ_REMOVE(&cc->nameq, wn, entry); free(wn->name); free(wn); diff --git a/group.c b/group.c index 7ab65f9..1bf2fd7 100644 --- a/group.c +++ b/group.c @@ -22,7 +22,6 @@ #include <sys/types.h> #include <sys/queue.h> -#include <assert.h> #include <err.h> #include <errno.h> #include <limits.h> @@ -264,9 +263,9 @@ group_cycle(struct screen_ctx *sc, int flags) { struct group_ctx *gc, *showgroup = NULL; - assert(sc->group_active != NULL); + if (((gc = sc->group_active)) == NULL) + errx(1, "group_cycle: no active group"); - gc = sc->group_active; for (;;) { gc = (flags & CWM_RCYCLE) ? TAILQ_PREV(gc, group_ctx_q, entry) : TAILQ_NEXT(gc, entry); diff --git a/search.c b/search.c index 770159b..9ddfd79 100644 --- a/search.c +++ b/search.c @@ -21,7 +21,6 @@ #include <sys/types.h> #include <sys/queue.h> -#include <assert.h> #include <err.h> #include <errno.h> #include <fnmatch.h> @@ -106,7 +105,8 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) if ((cc->flags & CLIENT_HIDDEN) && (tier > 0)) tier--; - assert(tier < nitems(tierp)); + if (tier >= nitems(tierp)) + errx(1, "search_match_client: invalid tier"); /* * If you have a tierp, insert after it, and make it |