From dfb4fd31240a7f19428da1b5978ddfc355c0c68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 31 Dec 2016 14:10:24 +0100 Subject: sam: use buffer_move where appropriate --- sam.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sam.c b/sam.c index a86cf35..6aedf70 100644 --- a/sam.c +++ b/sam.c @@ -478,7 +478,7 @@ static char *parse_until(const char **s, const char *until, const char *escchars if (buffer_length(&buf)) buffer_append(&buf, "\0", 1); - return buf.data; + return buffer_move(&buf); } static char *parse_delimited(const char **s, int type) { @@ -511,7 +511,7 @@ static char *parse_text(const char **s) { return NULL; } - return buf.data; + return buffer_move(&buf); } static char *parse_shellcmd(Vis *vis, const char **s) { @@ -546,7 +546,7 @@ static char *parse_cmdname(const char **s) { if (buffer_length(&buf)) buffer_append(&buf, "\0", 1); - return buf.data; + return buffer_move(&buf); } static Regex *parse_regex(Vis *vis, const char **s) { @@ -1282,7 +1282,7 @@ static bool cmd_substitute(Vis *vis, Win *win, Command *cmd, const char *argv[], buffer_init(&buf); bool ret = false; if (buffer_put0(&buf, "s") && buffer_append0(&buf, argv[1])) - ret = cmd_filter(vis, win, cmd, (const char*[]){ argv[0], "sed", buf.data, NULL }, cur, range); + ret = cmd_filter(vis, win, cmd, (const char*[]){ argv[0], "sed", buffer_move(&buf), NULL }, cur, range); buffer_release(&buf); return ret; } -- cgit v1.2.3