From b26523c26dc7cf0a24a1adb787aa1816deb40693 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 30 May 2019 20:54:03 +0000 Subject: [PATCH] Remove a leftover abort and some fixes from cppcheck. --- cmd-display-message.c | 3 +-- input.c | 1 - mode-tree.c | 2 +- options.c | 3 ++- window.c | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd-display-message.c b/cmd-display-message.c index 8c1ad5f6..4d9bccb6 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -109,8 +109,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) format_defaults(ft, target_c, s, wl, wp); if (args_has(args, 'a')) { - if (item != NULL) - format_each(ft, cmd_display_message_each, item); + format_each(ft, cmd_display_message_each, item); return (CMD_RETURN_NORMAL); } diff --git a/input.c b/input.c index 4095c05d..e54b5ac0 100644 --- a/input.c +++ b/input.c @@ -2409,7 +2409,6 @@ input_osc_52(struct input_ctx *ictx, const char *p) outlen = 4 * ((len + 2) / 3) + 1; out = xmalloc(outlen); if ((outlen = b64_ntop(buf, len, out, outlen)) == -1) { - abort(); free(out); return; } diff --git a/mode-tree.c b/mode-tree.c index 75034675..20ac3226 100644 --- a/mode-tree.c +++ b/mode-tree.c @@ -480,7 +480,7 @@ mode_tree_add(struct mode_tree_data *mtd, struct mode_tree_item *parent, saved = mode_tree_find_item(&mtd->saved, tag); if (saved != NULL) { - if (parent == NULL || (parent != NULL && parent->expanded)) + if (parent == NULL || parent->expanded) mti->tagged = saved->tagged; mti->expanded = saved->expanded; } else if (expanded == -1) diff --git a/options.c b/options.c index 7d79cf30..7e12544d 100644 --- a/options.c +++ b/options.c @@ -365,7 +365,8 @@ options_array_set(struct options_entry *o, u_int idx, const char *value, pr = cmd_parse_from_string(value, NULL); switch (pr->status) { case CMD_PARSE_EMPTY: - *cause = xstrdup("empty command"); + if (cause != NULL) + *cause = xstrdup("empty command"); return (-1); case CMD_PARSE_ERROR: if (cause != NULL) diff --git a/window.c b/window.c index b08a5d35..1d83c247 100644 --- a/window.c +++ b/window.c @@ -1136,7 +1136,7 @@ window_pane_reset_mode(struct window_pane *wp) } else { log_debug("%s: next mode is %s", __func__, next->mode->name); wp->screen = next->screen; - if (next != NULL && next->mode->resize != NULL) + if (next->mode->resize != NULL) next->mode->resize(next, wp->sx, wp->sy); } wp->flags |= (PANE_REDRAW|PANE_CHANGED);