From 83d0562ddfd20cee3ae28eda48eb1753f9b84abf Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 25 Apr 2019 19:37:00 +0000 Subject: options_array_item_value cannot return NULL. --- usr.bin/tmux/cmd.c | 6 +----- usr.bin/tmux/environ.c | 6 +----- usr.bin/tmux/status.c | 9 ++------- usr.bin/tmux/tty-keys.c | 5 ++--- usr.bin/tmux/tty-term.c | 5 ++--- 5 files changed, 8 insertions(+), 23 deletions(-) diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index 15ca4f0ca27..335279c5aa9 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.143 2019/04/23 20:36:55 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.144 2019/04/25 19:36:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -335,10 +335,6 @@ cmd_try_alias(int *argc, char ***argv) a = options_array_first(o); while (a != NULL) { ov = options_array_item_value(a); - if (ov == NULL) { - a = options_array_next(a); - continue; - } cp = strchr(ov->string, '='); if (cp != NULL && (size_t)(cp - ov->string) == wanted && diff --git a/usr.bin/tmux/environ.c b/usr.bin/tmux/environ.c index d248ef0b966..6c45a205067 100644 --- a/usr.bin/tmux/environ.c +++ b/usr.bin/tmux/environ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: environ.c,v 1.22 2019/04/23 20:36:55 nicm Exp $ */ +/* $OpenBSD: environ.c,v 1.23 2019/04/25 19:36:59 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -185,10 +185,6 @@ environ_update(struct options *oo, struct environ *src, struct environ *dst) a = options_array_first(o); while (a != NULL) { ov = options_array_item_value(a); - if (ov == NULL) { - a = options_array_next(a); - continue; - } if ((envent = environ_find(src, ov->string)) == NULL) environ_clear(dst, ov->string); else diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index 958ac0eddc2..ae18fa630f1 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.194 2019/04/23 20:40:03 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.195 2019/04/25 19:36:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1293,7 +1293,6 @@ status_prompt_complete_list(u_int *size, const char *s) size_t slen = strlen(s), valuelen; struct options_entry *o; struct options_array_item *a; - union options_value *ov; const char *layouts[] = { "even-horizontal", "even-vertical", "main-horizontal", "main-vertical", "tiled", NULL @@ -1322,11 +1321,7 @@ status_prompt_complete_list(u_int *size, const char *s) if (o != NULL) { a = options_array_first(o); while (a != NULL) { - ov = options_array_item_value(a); - if (ov == NULL) - goto next; - - value = ov->string; + value = options_array_item_value(a)->string; if ((cp = strchr(value, '=')) == NULL) goto next; valuelen = cp - value; diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index 00d11350b43..e7bb79471f1 100644 --- a/usr.bin/tmux/tty-keys.c +++ b/usr.bin/tmux/tty-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.109 2019/04/23 20:40:03 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.110 2019/04/25 19:36:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -429,8 +429,7 @@ tty_keys_build(struct tty *tty) a = options_array_first(o); while (a != NULL) { ov = options_array_item_value(a); - if (ov != NULL) - tty_keys_add(tty, ov->string, KEYC_USER + i); + tty_keys_add(tty, ov->string, KEYC_USER + i); a = options_array_next(a); } } diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index 5b63d58105d..e3db804c190 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.62 2019/04/23 20:36:55 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.63 2019/04/25 19:36:59 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -496,8 +496,7 @@ tty_term_find(char *name, int fd, char **cause) a = options_array_first(o); while (a != NULL) { ov = options_array_item_value(a); - if (ov != NULL) - tty_term_override(term, ov->string); + tty_term_override(term, ov->string); a = options_array_next(a); } -- cgit v1.2.3