Use separate fooFileno() functions for xzdio and lzdio

- Now that we can, take advantage of iotFileno() for these too,
  eliminating yet another subtly-different-from-everything-else
  case. Of course the per-filetype fooFileno() vectors start
  seeming fishy and at least redundant now but...
This commit is contained in:
Panu Matilainen 2013-03-04 19:38:23 +02:00
parent 374d877e97
commit af61b0d925
1 changed files with 6 additions and 13 deletions

View File

@ -1043,19 +1043,12 @@ static ssize_t lzwrite(LZFILE *lzfile, void *buf, size_t len)
static void * lzdFileno(FD_t fd)
{
void * rc = NULL;
if (fd == NULL)
return NULL;
return iotFileno(fd, lzdio);
}
for (int i = fd->nfps; i >= 0; i--) {
FDSTACK_t * fps = &fd->fps[i];
if (fps->io != xzdio && fps->io != lzdio)
continue;
rc = fps->fp;
break;
}
return rc;
static void * xzdFileno(FD_t fd)
{
return iotFileno(fd, xzdio);
}
static FD_t xzdOpen(const char * path, const char * mode)
@ -1172,7 +1165,7 @@ static int lzdClose(FD_t fd)
static struct FDIO_s xzdio_s = {
"xzdio", "xz",
lzdRead, lzdWrite, NULL, lzdClose,
NULL, xzdFdopen, xzdOpen, lzdFileno, lzdFlush, NULL, zfdError, zfdStrerr
NULL, xzdFdopen, xzdOpen, xzdFileno, lzdFlush, NULL, zfdError, zfdStrerr
};
static const FDIO_t xzdio = &xzdio_s;