From 3b07039fecbab82ecdefbdb2c064a839d506431a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 2 Feb 2017 13:12:15 +0100 Subject: Slight code cleanups, use buffer API where appropriate --- sam.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'sam.c') diff --git a/sam.c b/sam.c index af895fc..aa0580a 100644 --- a/sam.c +++ b/sam.c @@ -572,8 +572,7 @@ static char *parse_until(const char **s, const char *until, const char *escchars } } - if (buffer_length(&buf)) - buffer_append(&buf, "\0", 1); + buffer_terminate(&buf); return buffer_move(&buf); } @@ -643,8 +642,7 @@ static char *parse_cmdname(const char **s) { while (**s && !isspace((unsigned char)**s) && (!ispunct((unsigned char)**s) || **s == '-')) buffer_append(&buf, (*s)++, 1); - if (buffer_length(&buf)) - buffer_append(&buf, "\0", 1); + buffer_terminate(&buf); return buffer_move(&buf); } @@ -1627,9 +1625,7 @@ static bool cmd_pipeout(Vis *vis, Win *win, Command *cmd, const char *argv[], Cu if (vis->cancel_filter) vis_info_show(vis, "Command cancelled"); - else if (status == 0) - ; //vis_info_show(vis, "Command succeded"); - else + else if (status != 0) vis_info_show(vis, "Command failed %s", buffer_content0(&buferr)); buffer_release(&buferr); -- cgit v1.2.3