[hackers] [vis] [PATCH] Rename stderr field to err

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Sun, 31 Jan 2016 17:36:49 +0100

The name `stderr` was confused by the compiler with the following defines:
$ grep -r "define stderr"
./dependency/install/usr/include/stdio.h:#define stderr (stderr)
./dependency/sources/musl-1.1.12/include/stdio.h:#define stderr (stderr)
---
 vis-cmds.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/vis-cmds.c b/vis-cmds.c
index bc23193..9b2c887 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
_AT_@ -36,7 +36,7 @@ typedef struct {        /* used to keep context when dealing with external proce
 	Vis *vis;       /* editor instance */
 	Text *txt;      /* text into which received data will be inserted */
 	size_t pos;     /* position at which to insert new data */
-	Buffer stderr;  /* used to store everything the process writes to stderr */
+	Buffer err;     /* used to store everything the process writes to stderr */
 } Filter;
 
 /** ':'-command implementations */
_AT_@ -815,7 +815,7 @@ static ssize_t read_stdout(void *context, char *data, size_t len) {
 
 static ssize_t read_stderr(void *context, char *data, size_t len) {
 	Filter *filter = context;
-	buffer_append(&filter->stderr, data, len);
+	buffer_append(&filter->err, data, len);
 	return len;
 }
 
_AT_@ -829,7 +829,7 @@ static bool cmd_filter(Vis *vis, Filerange *range, enum CmdOpt opt, const char *
 		.pos = range->end != EPOS ? range->end : view_cursor_get(view),
 	};
 
-	buffer_init(&filter.stderr);
+	buffer_init(&filter.err);
 
 	/* The general idea is the following:
 	 *
_AT_@ -864,12 +864,12 @@ static bool cmd_filter(Vis *vis, Filerange *range, enum CmdOpt opt, const char *
 		vis_info_show(vis, "Command cancelled");
 	else if (status == 0)
 		vis_info_show(vis, "Command succeded");
-	else if (filter.stderr.len > 0)
-		vis_info_show(vis, "Command failed: %s", filter.stderr.data);
+	else if (filter.err.len > 0)
+		vis_info_show(vis, "Command failed: %s", filter.err.data);
 	else
 		vis_info_show(vis, "Command failed");
 
-	buffer_release(&filter.stderr);
+	buffer_release(&filter.err);
 
 	return !vis->cancel_filter && status == 0;
 }
_AT_@ -898,7 +898,7 @@ static bool cmd_pipe(Vis *vis, Filerange *range, enum CmdOpt opt, const char *ar
 		.pos = 0,
 	};
 
-	buffer_init(&filter.stderr);
+	buffer_init(&filter.err);
 
 	int status = vis_pipe(vis, &filter, range, argv, read_stdout_new, read_stderr);
 
_AT_@ -906,12 +906,12 @@ static bool cmd_pipe(Vis *vis, Filerange *range, enum CmdOpt opt, const char *ar
 		vis_info_show(vis, "Command cancelled");
 	else if (status == 0)
 		vis_info_show(vis, "Command succeded");
-	else if (filter.stderr.len > 0)
-		vis_info_show(vis, "Command failed: %s", filter.stderr.data);
+	else if (filter.err.len > 0)
+		vis_info_show(vis, "Command failed: %s", filter.err.data);
 	else
 		vis_info_show(vis, "Command failed");
 
-	buffer_release(&filter.stderr);
+	buffer_release(&filter.err);
 
 	return !vis->cancel_filter && status == 0;
 }
-- 
2.4.10
Received on Sun Jan 31 2016 - 17:36:49 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 31 2016 - 17:36:12 CET