From 80693fe2cecbdf8f8f0e95737dba4f1fbcf2ba59 Mon Sep 17 00:00:00 2001 From: jbj Date: Thu, 10 Dec 1998 20:56:01 +0000 Subject: [PATCH] Move inlines to rpmio.c. rpmio.h needs necessary includes. CVS patchset: 2594 CVS date: 1998/12/10 20:56:01 --- lib/Makefile.am | 5 +-- lib/Makefile.in | 5 +-- lib/rpmio.h | 99 +++++++++------------------------------------------------ popt/aclocal.m4 | 4 +-- 4 files changed, 23 insertions(+), 90 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index be04ee4..d937697 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -5,11 +5,12 @@ AUTOMAKE_OPTIONS = 1.3 foreign INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/build @INCPATH@ rpmincdir = $(includedir)/rpm -rpminc_HEADERS = dbindex.h header.h misc.h rpmlib.h rpmmacro.h stringbuf.h +rpminc_HEADERS = \ + dbindex.h header.h misc.h rpmio.h rpmlib.h rpmmacro.h stringbuf.h noinst_HEADERS = \ cpio.h depends.h falloc.h install.h \ md5.h oldheader.h oldrpmdb.h rpm_malloc.h \ - rpmdb.h rpmio.h rpmlead.h signature.h tread.h + rpmdb.h rpmlead.h signature.h tread.h lib_LIBRARIES = librpm.a librpm_a_SOURCES = \ diff --git a/lib/Makefile.in b/lib/Makefile.in index fa35b96..da338f5 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -127,11 +127,12 @@ AUTOMAKE_OPTIONS = 1.3 foreign INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/build @INCPATH@ rpmincdir = $(includedir)/rpm -rpminc_HEADERS = dbindex.h header.h misc.h rpmlib.h rpmmacro.h stringbuf.h +rpminc_HEADERS = \ + dbindex.h header.h misc.h rpmio.h rpmlib.h rpmmacro.h stringbuf.h noinst_HEADERS = \ cpio.h depends.h falloc.h install.h \ md5.h oldheader.h oldrpmdb.h rpm_malloc.h \ - rpmdb.h rpmio.h rpmlead.h signature.h tread.h + rpmdb.h rpmlead.h signature.h tread.h lib_LIBRARIES = librpm.a librpm_a_SOURCES = \ diff --git a/lib/rpmio.h b/lib/rpmio.h index e390d08..a4ef31f 100644 --- a/lib/rpmio.h +++ b/lib/rpmio.h @@ -2,6 +2,9 @@ #define H_RPMIO #include +#include +#include +#include typedef /*@abstract@*/ struct _FD { int fd_fd; @@ -21,92 +24,19 @@ extern "C" { int timedRead(FD_t fd, void * bufptr, int length); -extern inline /*@null@*/ FD_t fdNew(void); -extern inline /*@null@*/ FD_t fdNew(void) { - FD_t fd = (FD_t)malloc(sizeof(struct _FD)); - if (fd == NULL) - return NULL; - fd->fd_fd = -1; - fd->fd_bzd = NULL; - fd->fd_gzd = NULL; - fd->fd_url = NULL; - return fd; -} - -extern inline int fdValid(FD_t fd); -extern inline int fdValid(FD_t fd) { - return (fd != NULL && fd->fd_fd >= 0); -} - -extern inline int fdFileno(FD_t fd); -extern inline int fdFileno(FD_t fd) { - return (fd != NULL ? fd->fd_fd : -1); -} - -extern inline /*@null@*/ FD_t fdOpen(const char *pathname, int flags, mode_t mode); -extern inline /*@null@*/ FD_t fdOpen(const char *pathname, int flags, mode_t mode) { - FD_t fd; - int fdno; - if ((fdno = open(pathname, flags, mode)) < 0) - return NULL; - fd = fdNew(); - fd->fd_fd = fdno; - return fd; -} - -extern inline /*@null@*/ FD_t fdDup(int fdno); -extern inline /*@null@*/ FD_t fdDup(int fdno) { - FD_t fd; - int nfdno; - if ((nfdno = dup(fdno)) < 0) - return NULL; - fd = fdNew(); - fd->fd_fd = nfdno; - return fd; -} - -extern inline off_t fdLseek(FD_t fd, off_t offset, int whence); -extern inline off_t fdLseek(FD_t fd, off_t offset, int whence) { - return lseek(fdFileno(fd), offset, whence); -} - -extern inline ssize_t fdRead(FD_t fd, void * buf, size_t count); -extern inline ssize_t fdRead(FD_t fd, void * buf, size_t count) { - return read(fdFileno(fd), buf, count); -} - -extern inline ssize_t fdWrite(FD_t fd, const void * buf, size_t count); -extern inline ssize_t fdWrite(FD_t fd, const void * buf, size_t count) { - return write(fdFileno(fd), buf, count); -} +extern /*@null@*/ FD_t fdNew(void); +extern int fdValid(FD_t fd); +extern int fdFileno(FD_t fd); -extern inline int fdClose(/*@only@*/ FD_t fd); -extern inline int fdClose(/*@only@*/ FD_t fd) { - int fdno; +extern /*@null@*/ FD_t fdOpen(const char *pathname, int flags, mode_t mode); +extern /*@null@*/ FD_t fdDup(int fdno); - if (fd != NULL && (fdno = fdFileno(fd)) >= 0) { - fd->fd_fd = -1; - fd->fd_bzd = NULL; - fd->fd_gzd = NULL; - fd->fd_url = NULL; - free(fd); - return close(fdno); - } - return -2; -} +extern off_t fdLseek(FD_t fd, off_t offset, int whence); +extern ssize_t fdRead(FD_t fd, void * buf, size_t count); +extern ssize_t fdWrite(FD_t fd, const void * buf, size_t count); +extern int fdClose(/*@only@*/ FD_t fd); -extern inline /*@shared@*/ FILE *fdFdopen(/*@owned@*/ FD_t fd, const char *mode); -/*@-mustfree*/ -extern inline /*@shared@*/ FILE *fdFdopen(/*@owned@*/ FD_t fd, const char *mode) { - FILE *f = fdopen(fdFileno(fd), mode); - if (f != NULL) { - fd->fd_fd = -1; - free(fd); - return f; - } - return NULL; -} -/*@=mustfree*/ +extern /*@shared@*/ FILE *fdFdopen(/*@owned@*/ FD_t fd, const char *mode); /* * Support for GZIP library. @@ -204,7 +134,8 @@ extern inline int gzdClose(/*@only@*/ FD_t fd) { return -2; } -#endif /* HAVE_BZLIB_H */ +#endif /* HAVE_ZLIB_H */ + /* * Support for BZIP2 library. */ diff --git a/popt/aclocal.m4 b/popt/aclocal.m4 index d234055..2e1a7f0 100644 --- a/popt/aclocal.m4 +++ b/popt/aclocal.m4 @@ -1,7 +1,7 @@ -dnl aclocal.m4 generated automatically by aclocal 1.3 +dnl aclocal.m4 generated automatically by aclocal 1.3b dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. -dnl This Makefile.in is free software; the Free Software Foundation +dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -- 2.7.4