diff options
author | jbj <devnull@localhost> | 2000-10-28 17:16:25 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2000-10-28 17:16:25 +0000 |
commit | 3ad99fcba52fcc5e8ab636d2f1760c945cdfbf19 (patch) | |
tree | 1a99ac1cf7e49d8ab1719d50f111d23fafc71470 /rpmio | |
parent | b8f90f10cbb592d7ac15dccae503767f262cd719 (diff) | |
download | librpm-tizen-3ad99fcba52fcc5e8ab636d2f1760c945cdfbf19.tar.gz librpm-tizen-3ad99fcba52fcc5e8ab636d2f1760c945cdfbf19.tar.bz2 librpm-tizen-3ad99fcba52fcc5e8ab636d2f1760c945cdfbf19.zip |
- add cscope/ctags (Rodrigo Barbosa<rodrigob@conectiva.com.br>).
- remove getMacroBody() from rpmio API.
- hide libio lossage in prototype, not API.
lclint annotations.
CVS patchset: 4230
CVS date: 2000/10/28 17:16:25
Diffstat (limited to 'rpmio')
-rw-r--r-- | rpmio/macro.c | 10 | ||||
-rw-r--r-- | rpmio/rpmio.c | 55 | ||||
-rw-r--r-- | rpmio/rpmio.h | 41 | ||||
-rw-r--r-- | rpmio/rpmio_internal.h | 6 | ||||
-rw-r--r-- | rpmio/rpmlog.h | 4 | ||||
-rw-r--r-- | rpmio/rpmmacro.h | 11 |
6 files changed, 43 insertions, 84 deletions
diff --git a/rpmio/macro.c b/rpmio/macro.c index b0b26a77c..9c37106cb 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -1272,16 +1272,6 @@ expandMacro(MacroBuf *mb) } /* =============================================================== */ -/* XXX this is used only in build/expression.c and will go away. */ -const char * -getMacroBody(MacroContext *mc, const char *name) -{ - MacroEntry **mep = findEntry(mc, name, 0); - MacroEntry *me = (mep ? *mep : NULL); - return ( me ? me->body : (const char *)NULL ); -} - -/* =============================================================== */ int expandMacros(void *spec, MacroContext *mc, char *s, size_t slen) diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index 3bc6c5bbf..70b0c0717 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -189,11 +189,7 @@ DBGIO(fd, (stderr, "==> fdDup(%d) fd %p %s\n", fdno, fd, fdbg(fd))); /*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/ } -#ifdef USE_COOKIE_SEEK_POINTER -static inline int fdSeekNot(void * cookie, /*@unused@*/ _IO_off64_t *pos, /*@unused@*/ int whence) { -#else -static inline int fdSeekNot(void * cookie, /*@unused@*/ off_t pos, /*@unused@*/ int whence) { -#endif +static inline int fdSeekNot(void * cookie, /*@unused@*/ _libio_pos_t pos, /*@unused@*/ int whence) { FD_t fd = c2f(cookie); FDSANE(fd); /* XXX keep gcc quiet */ return -2; @@ -336,11 +332,11 @@ DBGIO(fd, (stderr, "==>\tfdWrite(%p,%p,%ld) rc %ld %s\n", cookie, buf, (long)cou return rc; } +static inline int fdSeek(void * cookie, _libio_pos_t pos, int whence) { #ifdef USE_COOKIE_SEEK_POINTER -static inline int fdSeek(void * cookie, _IO_off64_t *pos, int whence) { _IO_off64_t p = *pos; #else -static inline int fdSeek(void * cookie, off_t p, int whence) { + off_t p = pos; #endif FD_t fd = c2f(cookie); off_t rc; @@ -1558,11 +1554,7 @@ fprintf(stderr, "*** write: rc %d errno %d %s \"%s\"\n", rc, errno, strerror(err return count; } -#ifdef USE_COOKIE_SEEK_POINTER -static inline int ufdSeek(void * cookie, _IO_off64_t *pos, int whence) { -#else -static inline int ufdSeek(void * cookie, off_t pos, int whence) { -#endif +static inline int ufdSeek(void * cookie, _libio_pos_t pos, int whence) { FD_t fd = c2f(cookie); switch (fd->urlType) { @@ -1960,11 +1952,11 @@ DBGIO(fd, (stderr, "==>\tgzdWrite(%p,%p,%u) rc %lx %s\n", cookie, buf, (unsigned } /* XXX zlib-1.0.4 has not */ +static inline int gzdSeek(void * cookie, _libio_pos_t pos, int whence) { #ifdef USE_COOKIE_SEEK_POINTER -static inline int gzdSeek(void * cookie, _IO_off64_t *pos, int whence) { _IO_off64_t p = *pos; #else -static inline int gzdSeek(void * cookie, off_t p, int whence) { + off_t p = pos; #endif int rc; #if HAVE_GZSEEK @@ -2139,11 +2131,7 @@ static ssize_t bzdWrite(void * cookie, const char * buf, size_t count) { return rc; } -#ifdef USE_COOKIE_SEEK_POINTER -static inline int bzdSeek(void * cookie, _IO_off64_t *pos, int whence) { -#else -static inline int bzdSeek(void * cookie, off_t p, int whence) { -#endif +static inline int bzdSeek(void * cookie, _libio_pos_t pos, int whence) { FD_t fd = c2f(cookie); BZDONLY(fd); @@ -2263,12 +2251,15 @@ DBGIO(fd, (stderr, "==> Fwrite(%p,%u,%u,%p) %s\n", buf, (unsigned)size, (unsigne return rc; } +int Fseek(FD_t fd, _libio_off_t offset, int whence) { + fdio_seek_function_t *_seek; #ifdef USE_COOKIE_SEEK_POINTER -int Fseek(FD_t fd, _IO_off64_t offset, int whence) { -#else -int Fseek(FD_t fd, off_t offset, int whence) { + _IO_off64_t o64 = offset; + _libio_pos_t pos = &o64; +#else + _libio_pos_t pos = offset; #endif - fdio_seek_function_t *_seek; + long int rc; FDSANE(fd); @@ -2284,11 +2275,7 @@ DBGIO(fd, (stderr, "==> Fseek(%p,%ld,%d) %s\n", fd, (long)offset, whence, fdbg(f _seek = FDIOVEC(fd, seek); -#ifdef USE_COOKIE_SEEK_POINTER - rc = (_seek ? _seek(fd, &offset, whence) : -2); -#else - rc = (_seek ? _seek(fd, offset, whence) : -2); -#endif + rc = (_seek ? _seek(fd, pos, whence) : -2); return rc; } @@ -2644,21 +2631,13 @@ int Fcntl(FD_t fd, int op, void *lip) { */ /* XXX falloc.c: analogues to pread(3)/pwrite(3). */ -#ifdef USE_COOKIE_SEEK_POINTER -ssize_t Pread(FD_t fd, void * buf, size_t count, _IO_off64_t offset) { -#else -ssize_t Pread(FD_t fd, void * buf, size_t count, off_t offset) { -#endif +ssize_t Pread(FD_t fd, void * buf, size_t count, _libio_off_t offset) { if (Fseek(fd, offset, SEEK_SET) < 0) return -1; return Fread(buf, sizeof(char), count, fd); } -#ifdef USE_COOKIE_SEEK_POINTER -ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _IO_off64_t offset) { -#else -ssize_t Pwrite(FD_t fd, const void * buf, size_t count, off_t offset) { -#endif +ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset) { if (Fseek(fd, offset, SEEK_SET) < 0) return -1; return Fwrite(buf, sizeof(char), count, fd); diff --git a/rpmio/rpmio.h b/rpmio/rpmio.h index 30ce9eb7d..030855049 100644 --- a/rpmio/rpmio.h +++ b/rpmio/rpmio.h @@ -14,10 +14,23 @@ #include <stdlib.h> #include <unistd.h> -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 2 +/** \ingroup rpmio + * Hide libio API lossage. + * The libio interface changed after glibc-2.1.3 to pass the seek offset + * argument as a pointer rather than as an off_t. The snarl below defines + * typedefs to isolate the lossage. + * API unchanged. + */ +/*@{*/ +#if !defined(__LCLINT__) && defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 2 #define USE_COOKIE_SEEK_POINTER 1 +typedef _IO_off64_t _libio_off_t; +typedef _libio_off_t * _libio_pos_t; +#else +typedef off_t _libio_off_t; +typedef off_t _libio_pos_t; #endif - +/*@}*/ /** \ingroup rpmio */ @@ -46,11 +59,7 @@ typedef ssize_t fdio_write_function_t (void *cookie, const char *buf, size_t nby /** \ingroup rpmio */ -#ifdef USE_COOKIE_SEEK_POINTER -typedef int fdio_seek_function_t (void *cookie, _IO_off64_t * offset, int whence); -#else -typedef int fdio_seek_function_t (void *cookie, off_t offset, int whence); -#endif +typedef int fdio_seek_function_t (void *cookie, _libio_pos_t pos, int whence); /** \ingroup rpmio */ @@ -187,11 +196,7 @@ size_t Fwrite (const void *buf, size_t size, size_t nmemb, FD_t fd); /** \ingroup rpmio * fseek(3) clone. */ -#ifdef USE_COOKIE_SEEK_POINTER -int Fseek (FD_t fd, _IO_off64_t offset, int whence); -#else -int Fseek (FD_t fd, off_t offset, int whence); -#endif +int Fseek (FD_t fd, _libio_off_t offset, int whence); /** \ingroup rpmio * fclose(3) clone. @@ -232,20 +237,12 @@ int Fcntl (FD_t fd, int op, void *lip); /** \ingroup rpmio * pread(2) clone. */ -#ifdef USE_COOKIE_SEEK_POINTER -ssize_t Pread(FD_t fd, void * buf, size_t count, _IO_off64_t offset); -#else -ssize_t Pread(FD_t fd, void * buf, size_t count, off_t offset); -#endif +ssize_t Pread(FD_t fd, void * buf, size_t count, _libio_off_t offset); /** \ingroup rpmio * pwrite(2) clone. */ -#ifdef USE_COOKIE_SEEK_POINTER -ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _IO_off64_t offset); -#else -ssize_t Pwrite(FD_t fd, const void * buf, size_t count, off_t offset); -#endif +ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset); /*@}*/ /** \ingroup rpmrpc diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h index d4fae9b58..922e53c8d 100644 --- a/rpmio/rpmio_internal.h +++ b/rpmio/rpmio_internal.h @@ -57,7 +57,7 @@ typedef struct { void (*Transform) (void * private); } FDHASH_t; -extern FDHASH_t rpmio_md5hash; +/*@observer@*/ extern FDHASH_t rpmio_md5hash; /** \ingroup rpmio * The FD_t File Handle data structure. @@ -84,7 +84,7 @@ struct _FD_s { /*@observer@*/ const void *errcookie; /* gzdio/bzdio/ufdio: */ FDSTAT_t *stats; /* I/O statistics */ - FDHASH_t *hash; /* Hash vectors */ +/*@owned@*/ FDHASH_t *hash; /* Hash vectors */ int ftpFileDoneNeeded; /* ufdio: (FTP) */ unsigned int firstFree; /* fadio: */ @@ -316,8 +316,10 @@ int ufdClose( /*@only@*/ void * cookie); */ /*@unused@*/ static inline void fdInitMD5(FD_t fd) { fd->hash = xcalloc(1, sizeof(*fd->hash)); + /*@-globstate@*/ *fd->hash = rpmio_md5hash; /* structure assignment */ fd->hash->private = (*fd->hash->Init) (0); + /*@=globstate@*/ } /** \ingroup rpmio diff --git a/rpmio/rpmlog.h b/rpmio/rpmlog.h index 0bc2090df..02d3d9956 100644 --- a/rpmio/rpmlog.h +++ b/rpmio/rpmlog.h @@ -33,7 +33,7 @@ typedef enum rpmlogLvl_e { #define RPMLOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ /* extract priority */ #define RPMLOG_PRI(p) ((p) & RPMLOG_PRIMASK) -#define RPMLOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) +#define RPMLOG_MAKEPRI(fac, pri) ((((unsigned)(fac)) << 3) | (pri)) #ifdef RPMLOG_NAMES #define _RPMLOG_NOPRI 0x10 /* the "no priority" priority */ @@ -90,7 +90,7 @@ typedef enum rpmlogFac_e { RPMLOG_LOCAL7 = (23<<3), /*!< reserved for local use */ #define RPMLOG_NFACILITIES 24 /*!< current number of facilities */ - RPMLOG_ERRMSG = ((RPMLOG_NFACILITIES+0)<<3) + RPMLOG_ERRMSG = (((unsigned)(RPMLOG_NFACILITIES+0))<<3) } rpmlogFac; #define RPMLOG_FACMASK 0x03f8 /*!< mask to extract facility part */ diff --git a/rpmio/rpmmacro.h b/rpmio/rpmmacro.h index db5dc23d6..2b516843d 100644 --- a/rpmio/rpmmacro.h +++ b/rpmio/rpmmacro.h @@ -47,16 +47,6 @@ extern "C" { void rpmDumpMacroTable (MacroContext * mc, FILE * fp); /** - * Return value of macro. - * @deprecated Used only in build/expression.c. - * @todo Eliminate. - * @param mc macro context (NULL uses global context). - * @param name macro name - * @return macro body - */ -const char *getMacroBody (MacroContext *mc, const char *name); - -/** * Expand macro into buffer. * @deprecated Use rpmExpand(). * @todo Eliminate from API. @@ -93,6 +83,7 @@ void delMacro (MacroContext * mc, const char * n); * @param mc macro context (NULL uses global context). * @param n macro name, options, body * @param level macro recursion level (0 is entry API) + * @return @todo Document. */ int rpmDefineMacro (MacroContext * mc, const char * macro, int level); |