diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-10-14 16:10:08 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-10-14 16:10:08 +0300 |
commit | 63432905a413d33085061674e00d6c23c60056e4 (patch) | |
tree | 44ac9a5324ce520f4f1c0292b097a63b6711353f | |
parent | f2e55c2ff8f6fba0cba61251027fe899ac2fdd1a (diff) | |
download | librpm-tizen-63432905a413d33085061674e00d6c23c60056e4.tar.gz librpm-tizen-63432905a413d33085061674e00d6c23c60056e4.tar.bz2 librpm-tizen-63432905a413d33085061674e00d6c23c60056e4.zip |
Move pile of helpers from rpmio_internal.h to rpmio.c, remove unused stuff
- nothing outside rpmio.c needs these, make 'em static there
- uninlining reveals quite a few completely unused helpers...
-rw-r--r-- | rpmio/rpmio.c | 67 | ||||
-rw-r--r-- | rpmio/rpmio_internal.h | 113 |
2 files changed, 58 insertions, 122 deletions
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index 9ad154725..224842bcf 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -29,6 +29,64 @@ extern int h_errno; #include "debug.h" +static FDIO_t fdGetIo(FD_t fd) +{ + FDSANE(fd); + return fd->fps[fd->nfps].io; +} + +static void fdSetIo(FD_t fd, FDIO_t io) +{ + FDSANE(fd); + fd->fps[fd->nfps].io = io; +} + +static void * fdGetFp(FD_t fd) +{ + FDSANE(fd); + return fd->fps[fd->nfps].fp; +} + +static void fdSetFp(FD_t fd, void * fp) +{ + FDSANE(fd); + fd->fps[fd->nfps].fp = fp; +} + +static void fdSetFdno(FD_t fd, int fdno) +{ + FDSANE(fd); + fd->fps[fd->nfps].fdno = fdno; +} + +static void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno) +{ + FDSANE(fd); + if (fd->nfps >= (sizeof(fd->fps)/sizeof(fd->fps[0]) - 1)) + return; + fd->nfps++; + fdSetIo(fd, io); + fdSetFp(fd, fp); + fdSetFdno(fd, fdno); +} + +static void fdPop(FD_t fd) +{ + FDSANE(fd); + if (fd->nfps < 0) return; + fdSetIo(fd, NULL); + fdSetFp(fd, NULL); + fdSetFdno(fd, -1); + fd->nfps--; +} + +static FD_t c2f(void * cookie) +{ + FD_t fd = (FD_t) cookie; + FDSANE(fd); + return fd; +} + #define FDNREFS(fd) (fd ? ((FD_t)fd)->nrefs : -9) #define FDTO(fd) (fd ? ((FD_t)fd)->rd_timeoutsecs : -99) #define FDCPIOPOS(fd) (fd ? ((FD_t)fd)->fd_cpioPos : -99) @@ -647,15 +705,6 @@ static ssize_t ufdWrite(void * cookie, const char * buf, size_t count) int bytesWritten; int total = 0; -#ifdef NOTYET - if (fdGetIo(fd) == fdio) { - struct stat sb; - (void) fstat(fdGetFdno(fd), &sb); - if (S_ISREG(sb.st_mode)) - return fdWrite(fd, buf, count); - } -#endif - UFDONLY(fd); for (total = 0; total < count; total += bytesWritten) { diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h index 9e5bc26a9..acca88ed9 100644 --- a/rpmio/rpmio_internal.h +++ b/rpmio/rpmio_internal.h @@ -73,109 +73,6 @@ extern "C" { /** \ingroup rpmio */ static inline -FDIO_t fdGetIo(FD_t fd) -{ - FDSANE(fd); - return fd->fps[fd->nfps].io; -} - -/** \ingroup rpmio - */ -/* FIX: io may be NULL */ -static inline -void fdSetIo(FD_t fd, FDIO_t io) -{ - FDSANE(fd); - fd->fps[fd->nfps].io = io; -} - -/** \ingroup rpmio - */ -static inline -void * fdGetFp(FD_t fd) -{ - FDSANE(fd); - return fd->fps[fd->nfps].fp; -} - -/** \ingroup rpmio - */ -/* FIX: fp may be NULL */ -static inline -void fdSetFp(FD_t fd, void * fp) -{ - FDSANE(fd); - fd->fps[fd->nfps].fp = fp; -} - -/** \ingroup rpmio - */ -static inline -int fdGetFdno(FD_t fd) -{ - FDSANE(fd); - return fd->fps[fd->nfps].fdno; -} - -/** \ingroup rpmio - */ -static inline -void fdSetFdno(FD_t fd, int fdno) -{ - FDSANE(fd); - fd->fps[fd->nfps].fdno = fdno; -} - -/** \ingroup rpmio - */ -static inline -void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno) -{ - FDSANE(fd); - if (fd->nfps >= (sizeof(fd->fps)/sizeof(fd->fps[0]) - 1)) - return; - fd->nfps++; - fdSetIo(fd, io); - fdSetFp(fd, fp); - fdSetFdno(fd, fdno); -} - -/** \ingroup rpmio - */ -static inline -void fdPop(FD_t fd) -{ - FDSANE(fd); - if (fd->nfps < 0) return; - fdSetIo(fd, NULL); - fdSetFp(fd, NULL); - fdSetFdno(fd, -1); - fd->nfps--; -} - - -/** \ingroup rpmio - */ -static inline -void fdSetSyserrno(FD_t fd, int syserrno, const void * errcookie) -{ - FDSANE(fd); - fd->syserrno = syserrno; - fd->errcookie = errcookie; -} - -/** \ingroup rpmio - */ -static inline -int fdGetRdTimeoutSecs(FD_t fd) -{ - FDSANE(fd); - return fd->rd_timeoutsecs; -} - -/** \ingroup rpmio - */ -static inline rpm_loff_t fdGetCpioPos(FD_t fd) { FDSANE(fd); @@ -199,16 +96,6 @@ void fdSetBundle(FD_t fd, rpmDigestBundle bundle) } /** \ingroup rpmio - */ -static inline -FD_t c2f(void * cookie) -{ - FD_t fd = (FD_t) cookie; - FDSANE(fd); - return fd; -} - -/** \ingroup rpmio * Attach digest to fd. */ void fdInitDigest(FD_t fd, pgpHashAlgo hashalgo, int flags); |