diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2015-06-28 19:50:47 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2015-06-28 19:50:47 +0000 |
commit | 975bc702b6ab0ce396d2eb1543edef603188b754 (patch) | |
tree | 997f707f7baf4898cd25a2214ce5b804a46da0c1 | |
parent | d9eaba61ffa4b2ee00f3789bf0a35864c6908dab (diff) |
replace assert usage
-rw-r--r-- | app/cwm/client.c | 7 | ||||
-rw-r--r-- | app/cwm/group.c | 7 | ||||
-rw-r--r-- | app/cwm/search.c | 6 |
3 files changed, 9 insertions, 11 deletions
diff --git a/app/cwm/client.c b/app/cwm/client.c index 857ff8e33..94f00f9c9 100644 --- a/app/cwm/client.c +++ b/app/cwm/client.c @@ -15,13 +15,12 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.194 2015/06/26 17:17:46 okan Exp $ + * $OpenBSD: client.c,v 1.195 2015/06/28 19:50:46 okan Exp $ */ #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/app/cwm/group.c b/app/cwm/group.c index d18ece8f1..d2c0bf88d 100644 --- a/app/cwm/group.c +++ b/app/cwm/group.c @@ -16,13 +16,12 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: group.c,v 1.111 2015/03/28 23:12:47 okan Exp $ + * $OpenBSD: group.c,v 1.112 2015/06/28 19:50:46 okan Exp $ */ #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/app/cwm/search.c b/app/cwm/search.c index 44f233e88..deff8e38a 100644 --- a/app/cwm/search.c +++ b/app/cwm/search.c @@ -15,13 +15,12 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: search.c,v 1.43 2015/06/08 15:34:03 okan Exp $ + * $OpenBSD: search.c,v 1.44 2015/06/28 19:50:46 okan Exp $ */ #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 |