summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-11-04 09:31:08 +0000
committerJim Meyering <jim@meyering.net>2003-11-04 09:31:08 +0000
commitbf4248b344135e5b92ef73af2d9a5f9acb012879 (patch)
tree8edfe64ba9057bab2f1ea350f4dfa49ce9af97d5 /src
parent5506fdeffd63153f7c3e1ec4fd0538bab1e54122 (diff)
downloadcoreutils-bf4248b344135e5b92ef73af2d9a5f9acb012879.tar.xz
(memrchr): Remove #if-0'd function.
(tac_stdin_to_mem): Clean up #if-0'd code.
Diffstat (limited to 'src')
-rw-r--r--src/tac.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/tac.c b/src/tac.c
index e0bc93b53..172f0d701 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -502,18 +502,6 @@ tac_stdin (void)
#if 0
/* BUF_END points one byte past the end of the buffer to be searched. */
-static void *
-memrchr (const char *buf_start, const char *buf_end, int c)
-{
- const char *p = buf_end;
- while (buf_start <= --p)
- {
- if (*(const unsigned char *) p == c)
- return (void *) p;
- }
- return NULL;
-}
-
/* FIXME: describe */
static void
@@ -571,19 +559,21 @@ tac_stdin_to_mem (void)
while (1)
{
size_t bytes_read;
- if (buf == NULL)
- buf = (char *) malloc (bufsiz);
- else
- buf = (char *) realloc (buf, bufsiz);
+ char *new_buf = realloc (buf, bufsiz);
- if (buf == NULL)
+ if (new_buf == NULL)
{
+ /* Write contents of buf to a temporary file, ... */
+ /* FIXME */
+
/* Free the buffer and fall back on the code that relies on a
temporary file. */
free (buf);
/* FIXME */
abort ();
}
+
+ buf = new_buf;
bytes_read = safe_read (STDIN_FILENO, buf + n_bytes, bufsiz - n_bytes);
if (bytes_read == 0)
break;