summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-03-22 13:25:57 +0200
committerPanu Matilainen <pmatilai@redhat.com>2010-03-22 13:25:57 +0200
commitd71964bda572f5fd141ddc35b506d4086e631264 (patch)
tree928cd891832aa4c170e932ba5ffdd94e8226c2c1
parentb02d4f20a0bf2b1cf96ace4dbcbfddd4a54f0a08 (diff)
downloadlibrpm-tizen-d71964bda572f5fd141ddc35b506d4086e631264.tar.gz
librpm-tizen-d71964bda572f5fd141ddc35b506d4086e631264.tar.bz2
librpm-tizen-d71964bda572f5fd141ddc35b506d4086e631264.zip
Lose the useless rpmio refcounting debug junk
- the rpmio API always had this goo, should've gotten rid of it back in commit dbdbe8010cd944f026a5a4e5d071eb31d29d81c4 but .. oh well
-rw-r--r--build/pack.c10
-rw-r--r--lib/fsm.c4
-rw-r--r--lib/rpminstall.c4
-rw-r--r--lib/rpmte.c6
-rw-r--r--lib/rpmts.c8
-rw-r--r--rpmio/rpmio.c71
-rw-r--r--rpmio/rpmio.h6
-rw-r--r--tools/rpminject.c2
8 files changed, 49 insertions, 62 deletions
diff --git a/build/pack.c b/build/pack.c
index 3af9facb4..c7622cc38 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -788,13 +788,12 @@ rpmRC packageBinaries(rpmSpec spec)
memset(csa, 0, sizeof(*csa));
csa->cpioArchiveSize = 0;
- csa->cpioFdIn = fdNew(RPMDBG_M("init (packageBinaries)"));
+ csa->cpioFdIn = fdNew();
csa->cpioList = rpmfiLink(pkg->cpioList);
rc = writeRPM(&pkg->header, NULL, fn, csa, spec->passPhrase, NULL);
csa->cpioList = rpmfiFree(csa->cpioList);
- csa->cpioFdIn = fdFree(csa->cpioFdIn,
- RPMDBG_M("init (packageBinaries)"));
+ csa->cpioFdIn = fdFree(csa->cpioFdIn);
if (rc == RPMRC_OK) {
/* Do check each written package if enabled */
char *pkgcheck = rpmExpand("%{?_build_pkgcheck} ", fn, NULL);
@@ -844,7 +843,7 @@ rpmRC packageSources(rpmSpec spec)
memset(csa, 0, sizeof(*csa));
csa->cpioArchiveSize = 0;
- csa->cpioFdIn = fdNew(RPMDBG_M("init (packageSources)"));
+ csa->cpioFdIn = fdNew();
csa->cpioList = rpmfiLink(spec->sourceCpioList);
spec->sourcePkgId = NULL;
@@ -857,8 +856,7 @@ rpmRC packageSources(rpmSpec spec)
}
csa->cpioList = rpmfiFree(csa->cpioList);
- csa->cpioFdIn = fdFree(csa->cpioFdIn,
- RPMDBG_M("init (packageSources)"));
+ csa->cpioFdIn = fdFree(csa->cpioFdIn);
pkgcheck = _free(pkgcheck);
fn = _free(fn);
}
diff --git a/lib/fsm.c b/lib/fsm.c
index c6264f360..3b9a4c44d 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -519,7 +519,7 @@ int fsmSetup(FSM_t fsm, fileStage goal,
fsm->goal = goal;
if (cfd != NULL) {
- fsm->cfd = fdLink(cfd, RPMDBG_M("persist (fsm)"));
+ fsm->cfd = fdLink(cfd);
}
fsm->cpioPos = 0;
fsm->iter = mapInitIterator(ts, te, fi);
@@ -568,7 +568,7 @@ int fsmTeardown(FSM_t fsm)
fsm->iter = mapFreeIterator(fsm->iter);
if (fsm->cfd != NULL) {
- fsm->cfd = fdFree(fsm->cfd, RPMDBG_M("persist (fsm)"));
+ fsm->cfd = fdFree(fsm->cfd);
fsm->cfd = NULL;
}
fsm->failedFile = NULL;
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 568e13f49..b03dd35b8 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -119,13 +119,13 @@ void * rpmShowProgress(const void * arg,
fd = NULL;
}
} else
- fd = fdLink(fd, RPMDBG_M("persist (showProgress)"));
+ fd = fdLink(fd);
return (void *)fd;
break;
case RPMCALLBACK_INST_CLOSE_FILE:
/* FIX: still necessary? */
- fd = fdFree(fd, RPMDBG_M("persist (showProgress)"));
+ fd = fdFree(fd);
if (fd != NULL) {
Fclose(fd);
fd = NULL;
diff --git a/lib/rpmte.c b/lib/rpmte.c
index a0da76c19..75fb02102 100644
--- a/lib/rpmte.c
+++ b/lib/rpmte.c
@@ -93,7 +93,7 @@ static void delTE(rpmte p)
p->fi = rpmfiFree(p->fi);
if (p->fd != NULL)
- p->fd = fdFree(p->fd, RPMDBG_M("delTE"));
+ p->fd = fdFree(p->fd);
p->os = _free(p->os);
p->arch = _free(p->arch);
@@ -456,9 +456,9 @@ FD_t rpmteSetFd(rpmte te, FD_t fd)
{
if (te != NULL) {
if (te->fd != NULL)
- te->fd = fdFree(te->fd, RPMDBG_M("rpmteSetFd"));
+ te->fd = fdFree(te->fd);
if (fd != NULL)
- te->fd = fdLink(fd, RPMDBG_M("rpmteSetFd"));
+ te->fd = fdLink(fd);
}
return NULL;
}
diff --git a/lib/rpmts.c b/lib/rpmts.c
index ea4edb1f8..970a5d374 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -584,7 +584,7 @@ rpmts rpmtsFree(rpmts ts)
ts->dsi = _free(ts->dsi);
if (ts->scriptFd != NULL) {
- ts->scriptFd = fdFree(ts->scriptFd, RPMDBG_M("rpmtsFree"));
+ ts->scriptFd = fdFree(ts->scriptFd);
ts->scriptFd = NULL;
}
ts->rootDir = _free(ts->rootDir);
@@ -674,13 +674,11 @@ void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
if (ts != NULL) {
if (ts->scriptFd != NULL) {
- ts->scriptFd = fdFree(ts->scriptFd,
- RPMDBG_M("rpmtsSetScriptFd"));
+ ts->scriptFd = fdFree(ts->scriptFd);
ts->scriptFd = NULL;
}
if (scriptFd != NULL)
- ts->scriptFd = fdLink((void *)scriptFd,
- RPMDBG_M("rpmtsSetScriptFd"));
+ ts->scriptFd = fdLink(scriptFd);
}
}
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
index 70a3f04fb..56a03d83b 100644
--- a/rpmio/rpmio.c
+++ b/rpmio/rpmio.c
@@ -70,7 +70,6 @@ struct _FD_s {
if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x \
#define DBGIO(_f, _x) DBG((_f), RPMIO_DEBUG_IO, _x)
-#define DBGREFS(_f, _x) DBG((_f), RPMIO_DEBUG_REFS, _x)
static FDIO_t fdGetIo(FD_t fd)
{
@@ -182,9 +181,9 @@ typedef ssize_t (*fdio_read_function_t) (void *cookie, char *buf, size_t nbytes)
typedef ssize_t (*fdio_write_function_t) (void *cookie, const char *buf, size_t nbytes);
typedef int (*fdio_seek_function_t) (void *cookie, _libio_pos_t pos, int whence);
typedef int (*fdio_close_function_t) (void *cookie);
-typedef FD_t (*fdio_ref_function_t) ( void * cookie, const char * msg);
-typedef FD_t (*fdio_deref_function_t) ( FD_t fd, const char * msg);
-typedef FD_t (*fdio_new_function_t) (const char * msg);
+typedef FD_t (*fdio_ref_function_t) ( void * cookie);
+typedef FD_t (*fdio_deref_function_t) (FD_t fd);
+typedef FD_t (*fdio_new_function_t) (void);
typedef int (*fdio_fileno_function_t) (void * cookie);
typedef FD_t (*fdio_open_function_t) (const char * path, int flags, mode_t mode);
typedef FD_t (*fdio_fopen_function_t) (const char * path, const char * fmode);
@@ -357,7 +356,7 @@ FD_t fdDup(int fdno)
if ((nfdno = dup(fdno)) < 0)
return NULL;
- fd = fdNew(RPMDBG_M("open (fdDup)"));
+ fd = fdNew();
fdSetFdno(fd, nfdno);
DBGIO(fd, (stderr, "==> fdDup(%d) fd %p %s\n", fdno, (fd ? fd : NULL), fdbg(fd)));
return fd;
@@ -387,28 +386,20 @@ FILE * fdGetFILE(FD_t fd)
/* =============================================================== */
-FD_t fdLink(void * cookie, const char * msg)
+FD_t fdLink(void * cookie)
{
- FD_t fd;
-if (cookie == NULL)
-DBGREFS(0, (stderr, "--> fd %p ++ %d %s\n", cookie, FDNREFS(cookie)+1, msg));
- fd = c2f(cookie);
- if (fd) {
+ FD_t fd = c2f(cookie);
+ if (fd)
fd->nrefs++;
-DBGREFS(fd, (stderr, "--> fd %p ++ %d %s %s\n", fd, fd->nrefs, msg, fdbg(fd)));
- }
return fd;
}
/**
*/
-FD_t fdFree( FD_t fd, const char *msg)
+FD_t fdFree( FD_t fd)
{
-if (fd == NULL)
-DBGREFS(0, (stderr, "--> fd %p -- %d %s\n", fd, FDNREFS(fd), msg));
FDSANE(fd);
if (fd) {
-DBGREFS(fd, (stderr, "--> fd %p -- %d %s %s\n", fd, fd->nrefs, msg, fdbg(fd)));
if (--fd->nrefs > 0)
return fd;
fd->stats = _free(fd->stats);
@@ -422,7 +413,7 @@ DBGREFS(fd, (stderr, "--> fd %p -- %d %s %s\n", fd, fd->nrefs, msg, fdbg(fd)));
/**
*/
-FD_t fdNew(const char * msg)
+FD_t fdNew(void)
{
FD_t fd = xcalloc(1, sizeof(*fd));
if (fd == NULL) /* XXX xmalloc never returns NULL */
@@ -445,7 +436,7 @@ FD_t fdNew(const char * msg)
fd->stats = xcalloc(1, sizeof(*fd->stats));
fd->digests = NULL;
- return fdLink(fd, msg);
+ return fdLink(fd);
}
/**
@@ -531,7 +522,7 @@ static int fdClose( void * cookie)
DBGIO(fd, (stderr, "==>\tfdClose(%p) rc %lx %s\n", (fd ? fd : NULL), (unsigned long)rc, fdbg(fd)));
- fd = fdFree(fd, "open (fdClose)");
+ fd = fdFree(fd);
return rc;
}
@@ -548,7 +539,7 @@ static FD_t fdOpen(const char *path, int flags, mode_t mode)
(void) close(fdno);
return NULL;
}
- fd = fdNew(RPMDBG_M("open (fdOpen)"));
+ fd = fdNew();
fdSetFdno(fd, fdno);
fd->flags = flags;
DBGIO(fd, (stderr, "==>\tfdOpen(\"%s\",%x,0%o) %s\n", path, (unsigned)flags, (unsigned)mode, fdbg(fd)));
@@ -794,11 +785,11 @@ FD_t gzdOpen(const char * path, const char * fmode)
gzFile gzfile;
if ((gzfile = gzopen(path, fmode)) == NULL)
return NULL;
- fd = fdNew(RPMDBG_M("open (gzdOpen)"));
+ fd = fdNew();
fdPop(fd); fdPush(fd, gzdio, gzfile, -1);
DBGIO(fd, (stderr, "==>\tgzdOpen(\"%s\", \"%s\") fd %p %s\n", path, fmode, (fd ? fd : NULL), fdbg(fd)));
- return fdLink(fd, RPMDBG_M("gzdOpen"));
+ return fdLink(fd);
}
static FD_t gzdFdopen(void * cookie, const char *fmode)
@@ -816,7 +807,7 @@ static FD_t gzdFdopen(void * cookie, const char *fmode)
fdPush(fd, gzdio, gzfile, fdno); /* Push gzdio onto stack */
- return fdLink(fd, RPMDBG_M("gzdFdopen"));
+ return fdLink(fd);
}
static int gzdFlush(FD_t fd)
@@ -954,7 +945,7 @@ DBGIO(fd, (stderr, "==>\tgzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, f
if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "GZDIO", stderr);
if (rc == 0)
- fd = fdFree(fd, RPMDBG_M("open (gzdClose)"));
+ fd = fdFree(fd);
return rc;
}
@@ -994,9 +985,9 @@ static FD_t bzdOpen(const char * path, const char * mode)
BZFILE *bzfile;;
if ((bzfile = bzopen(path, mode)) == NULL)
return NULL;
- fd = fdNew(RPMDBG_M("open (bzdOpen)"));
+ fd = fdNew();
fdPop(fd); fdPush(fd, bzdio, bzfile, -1);
- return fdLink(fd, RPMDBG_M("bzdOpen"));
+ return fdLink(fd);
}
static FD_t bzdFdopen(void * cookie, const char * fmode)
@@ -1014,7 +1005,7 @@ static FD_t bzdFdopen(void * cookie, const char * fmode)
fdPush(fd, bzdio, bzfile, fdno); /* Push bzdio onto stack */
- return fdLink(fd, RPMDBG_M("bzdFdopen"));
+ return fdLink(fd);
}
static int bzdFlush(FD_t fd)
@@ -1096,7 +1087,7 @@ DBGIO(fd, (stderr, "==>\tbzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, f
if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "BZDIO", stderr);
if (rc == 0)
- fd = fdFree(fd, RPMDBG_M("open (bzdClose)"));
+ fd = fdFree(fd);
return rc;
}
@@ -1348,9 +1339,9 @@ static FD_t xzdOpen(const char * path, const char * mode)
LZFILE *lzfile;
if ((lzfile = xzopen(path, mode)) == NULL)
return NULL;
- fd = fdNew("open (xzdOpen)");
+ fd = fdNew();
fdPop(fd); fdPush(fd, xzdio, lzfile, -1);
- return fdLink(fd, "xzdOpen");
+ return fdLink(fd);
}
static FD_t xzdFdopen(void * cookie, const char * fmode)
@@ -1366,7 +1357,7 @@ static FD_t xzdFdopen(void * cookie, const char * fmode)
lzfile = xzdopen(fdno, fmode);
if (lzfile == NULL) return NULL;
fdPush(fd, xzdio, lzfile, fdno);
- return fdLink(fd, "xzdFdopen");
+ return fdLink(fd);
}
static FD_t lzdOpen(const char * path, const char * mode)
@@ -1375,9 +1366,9 @@ static FD_t lzdOpen(const char * path, const char * mode)
LZFILE *lzfile;
if ((lzfile = lzopen(path, mode)) == NULL)
return NULL;
- fd = fdNew("open (lzdOpen)");
+ fd = fdNew();
fdPop(fd); fdPush(fd, xzdio, lzfile, -1);
- return fdLink(fd, "lzdOpen");
+ return fdLink(fd);
}
static FD_t lzdFdopen(void * cookie, const char * fmode)
@@ -1393,7 +1384,7 @@ static FD_t lzdFdopen(void * cookie, const char * fmode)
lzfile = lzdopen(fdno, fmode);
if (lzfile == NULL) return NULL;
fdPush(fd, xzdio, lzfile, fdno);
- return fdLink(fd, "lzdFdopen");
+ return fdLink(fd);
}
static int lzdFlush(FD_t fd)
@@ -1470,7 +1461,7 @@ DBGIO(fd, (stderr, "==>\tlzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, f
if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "XZDIO", stderr);
if (rc == 0)
- fd = fdFree(fd, "open (lzdClose)");
+ fd = fdFree(fd);
return rc;
}
@@ -1573,7 +1564,7 @@ int Fclose(FD_t fd)
FDSANE(fd);
DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", (fd ? fd : NULL), fdbg(fd)));
- fd = fdLink(fd, RPMDBG_M("Fclose"));
+ fd = fdLink(fd);
while (fd->nfps >= 0) {
FDSTACK_t * fps = &fd->fps[fd->nfps];
@@ -1586,7 +1577,7 @@ DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", (fd ? fd : NULL), fdbg(fd)));
if (fp)
rc = fclose(fp);
if (fpno == -1) {
- fd = fdFree(fd, RPMDBG_M("fopencookie (Fclose)"));
+ fd = fdFree(fd);
fdPop(fd);
}
} else {
@@ -1599,7 +1590,7 @@ DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", (fd ? fd : NULL), fdbg(fd)));
ec = rc;
fdPop(fd);
}
- fd = fdFree(fd, RPMDBG_M("Fclose"));
+ fd = fdFree(fd);
return ec;
}
@@ -1775,7 +1766,7 @@ DBGIO(fd, (stderr, "==> fopencookie(%p,\"%s\",*%p) returns fp %p\n", fd, stdio,
if (fdGetFp(fd) == NULL)
fdSetFp(fd, fp);
fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
- fd = fdLink(fd, RPMDBG_M("fopencookie"));
+ fd = fdLink(fd);
}
}
diff --git a/rpmio/rpmio.h b/rpmio/rpmio.h
index a31337182..760855607 100644
--- a/rpmio/rpmio.h
+++ b/rpmio/rpmio.h
@@ -124,15 +124,15 @@ FILE * fdGetFILE(FD_t fd);
/** \ingroup rpmio
*/
-FD_t fdLink (void * cookie, const char * msg);
+FD_t fdLink(void * cookie);
/** \ingroup rpmio
*/
-FD_t fdFree(FD_t fd, const char * msg);
+FD_t fdFree(FD_t fd);
/** \ingroup rpmio
*/
-FD_t fdNew (const char * msg);
+FD_t fdNew (void);
/** \ingroup rpmio
*/
diff --git a/tools/rpminject.c b/tools/rpminject.c
index 6d4316cd5..5d966d0f6 100644
--- a/tools/rpminject.c
+++ b/tools/rpminject.c
@@ -372,7 +372,7 @@ rewriteRPM(const char *fni, const char *fno, cmd_t *cmds[], int ncmds)
int rc;
csa->cpioArchiveSize = 0;
- csa->cpioFdIn = fdNew("init (rewriteRPM)");
+ csa->cpioFdIn = fdNew();
csa->cpioList = NULL;
/* Read rpm and (partially) recreate spec/pkg control structures */