GNU bug report logs -
#8565
gzip/bzip2/output-hook support for split
Previous Next
Reported by: Ari Pollak <aripollak <at> gmail.com>
Date: Wed, 27 Apr 2011 06:46:02 UTC
Severity: normal
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Karl Heuer wrote:
>>Karl, this is a good time to add the feature.
>>If you don't have time to handle the remaining bits (test,
>>doc and NEWS), let us know and we will take care of the rest.
>
> I'd better let you do it; I've got too many other items in my
> queue at the moment.
Ok. For starters, I'm squashing this onto your patch.
The type change is required to get past this compilation error:
split.c: In function 'create':
split.c:334:42: error: passing argument 2 of 'x2nrealloc' from incompatible pointer type [-Werror]
../lib/xalloc.h:191:1: note: expected 'size_t *' but argument is of type 'int *'
cc1: all warnings being treated as errors
Also, at least initially, I'll remove the short-named (-f)
version of your new --filter option, just to be on the safe side.
People can always abbreviate using "--f".
From 6b72fcbf896e082cc797b601c0f4e2533a479981 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering <at> redhat.com>
Date: Fri, 29 Apr 2011 12:26:50 +0200
Subject: [PATCH] split: minor adjustments: s/int/size_t/ for new globals,
and...
rename: open_pipes_size -> open_pipes_alloc
and open_pipes_len -> n_open_pipes
---
src/split.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/split.c b/src/split.c
index c977ceb..2b9cdfc 100644
--- a/src/split.c
+++ b/src/split.c
@@ -56,8 +56,8 @@ static int filter_pid;
/* Array of open pipes. */
static int *open_pipes;
-static int open_pipes_size;
-static int open_pipes_len;
+static size_t open_pipes_alloc;
+static size_t n_open_pipes;
/* Blocked signals. */
static sigset_t oldblocked;
@@ -307,7 +307,7 @@ create (const char* name)
earlier call, otherwise this process will be holding a
write-pipe that will prevent the earlier process from
reading an EOF on the corresponding read-pipe. */
- for (j = 0; j < open_pipes_len; ++j)
+ for (j = 0; j < n_open_pipes; ++j)
if (close (open_pipes[j]) != 0)
error (EXIT_FAILURE, errno, _("closing prior pipe"));
if (close (fd_pair[1]))
@@ -329,10 +329,10 @@ create (const char* name)
if (close (fd_pair[0]) != 0)
error (EXIT_FAILURE, errno, _("closing input pipe"));
filter_pid = child_pid;
- if (open_pipes_len == open_pipes_size)
- open_pipes = (int *) x2nrealloc (open_pipes, &open_pipes_size,
+ if (n_open_pipes == open_pipes_alloc)
+ open_pipes = (int *) x2nrealloc (open_pipes, &open_pipes_alloc,
sizeof *open_pipes);
- open_pipes[open_pipes_len++] = fd_pair[1];
+ open_pipes[n_open_pipes++] = fd_pair[1];
return fd_pair[1];
}
}
@@ -350,9 +350,9 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name)
if (fp == NULL && close (fd) < 0)
error (EXIT_FAILURE, errno, "%s", name);
int j;
- for (j = 0; j < open_pipes_len; ++j)
+ for (j = 0; j < n_open_pipes; ++j)
if (open_pipes[j] == fd) {
- open_pipes[j] = open_pipes[--open_pipes_len];
+ open_pipes[j] = open_pipes[--n_open_pipes];
break;
}
}
--
1.7.5.452.gcf2d0
This bug report was last modified 13 years and 300 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.