<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch release-2.4
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/3e668ccc520940e2ece1e40533a6cbf361dc2b97">https://github.com/macports/macports-base/commit/3e668ccc520940e2ece1e40533a6cbf361dc2b97</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/release-2.4 by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 3e668cc system: Get rid of unused circbuf
</span>3e668cc is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 3e668ccc520940e2ece1e40533a6cbf361dc2b97
</span>Author: Rainer Müller <raimue@macports.org>
AuthorDate: Mon Apr 2 12:15:28 2018 +0200
<span style='display:block; white-space:pre;color:#404040;'> system: Get rid of unused circbuf
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> This buffer was once used to return the last 30 lines of command output
</span><span style='display:block; white-space:pre;color:#404040;'> in case of an error, but this functionality was already removed a long
</span><span style='display:block; white-space:pre;color:#404040;'> time ago in 17a5605c.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> (cherry picked from commit fcd8c218cf94951112803e1998d80b42bc693370)
</span>---
src/pextlib1.0/system.c | 32 +++-----------------------------
1 file changed, 3 insertions(+), 29 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/pextlib1.0/system.c b/src/pextlib1.0/system.c
</span><span style='display:block; white-space:pre;color:#808080;'>index 22b4bb0..8aa8587 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/pextlib1.0/system.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/pextlib1.0/system.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -80,13 +80,6 @@ char *fgetln(FILE *stream, size_t *len);
</span> #define _PATH_DEVNULL "/dev/null"
#endif
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#define CBUFSIZ 30
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-struct linebuf {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- size_t len;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- char *line;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-};
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> static int check_sandboxing(Tcl_Interp *interp, char **sandbox_exec_path, char **profilestr)
{
Tcl_Obj *tcl_result;
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -121,7 +114,6 @@ static void handle_sigint(int s) {
</span> int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
{
char *buf;
<span style='display:block; white-space:pre;background:#ffe0e0;'>- struct linebuf circbuf[CBUFSIZ];
</span> size_t linelen;
char *args[7];
char *cmdstring;
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -130,7 +122,7 @@ int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Ob
</span> char *profilestr = NULL;
FILE *pdes;
int fdset[2], nullfd;
<span style='display:block; white-space:pre;background:#ffe0e0;'>- int fline, pos, ret;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int ret;
</span> int osetsid = 0;
int odup = 1; /* redirect stdin/stdout/stderr by default */
int oniceval = INT_MAX; /* magic value indicating no change */
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -296,8 +288,6 @@ int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Ob
</span>
/* read from simulated popen() pipe */
read_failed = 0;
<span style='display:block; white-space:pre;background:#ffe0e0;'>- pos = 0;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- memset(circbuf, 0, sizeof(circbuf));
</span> pdes = fdopen(fdset[0], "r");
if (pdes) {
while ((buf = fgetln(pdes, &linelen)) != NULL) {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -313,12 +303,7 @@ int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Ob
</span> else
slen = linelen + 1;
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (circbuf[pos].len == 0)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- sbuf = malloc(slen);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- sbuf = realloc(circbuf[pos].line, slen);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sbuf = malloc(slen);
</span> if (sbuf == NULL) {
read_failed = 1;
break;
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -328,14 +313,8 @@ int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Ob
</span> /* terminate line with '\0',replacing '\n' if it exists */
sbuf[slen - 1] = '\0';
<span style='display:block; white-space:pre;background:#ffe0e0;'>- circbuf[pos].line = sbuf;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- circbuf[pos].len = slen;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if (pos++ == CBUFSIZ - 1) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- pos = 0;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> ui_info(interp, "%s", sbuf);
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ free(sbuf);
</span> }
fclose(pdes);
} else {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -396,11 +375,6 @@ int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Ob
</span> if (odup) {
/* Cleanup. */
close(fdset[0]);
<span style='display:block; white-space:pre;background:#ffe0e0;'>- for (fline = 0; fline < CBUFSIZ; fline++) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if (circbuf[fline].len != 0) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- free(circbuf[fline].line);
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span> }
return status;
</pre><pre style='margin:0'>
</pre>