summaryrefslogtreecommitdiff
path: root/lib/rpmgi.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-03-19 16:30:55 +0200
committerPanu Matilainen <pmatilai@redhat.com>2010-03-19 16:55:49 +0200
commit97b6c385898342958624c17c441c65d474cb7fcd (patch)
tree5d7d327b94ccc8329893339425dee3e87d79e1b4 /lib/rpmgi.c
parent89b3b386123ae81b31a07400b02eae2e779985cf (diff)
downloadrpm-97b6c385898342958624c17c441c65d474cb7fcd.tar.gz
rpm-97b6c385898342958624c17c441c65d474cb7fcd.tar.bz2
rpm-97b6c385898342958624c17c441c65d474cb7fcd.zip
One helluva complicated way to pass our own arg back to us
Diffstat (limited to 'lib/rpmgi.c')
-rw-r--r--lib/rpmgi.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/lib/rpmgi.c b/lib/rpmgi.c
index 19c3211fb..12ddb430b 100644
--- a/lib/rpmgi.c
+++ b/lib/rpmgi.c
@@ -35,7 +35,6 @@ struct rpmgi_s {
int active; /*!< Iterator is active? */
int i; /*!< Element index. */
int errors;
- char * hdrPath; /*!< Path to current iterator header. */
Header h; /*!< Current iterator header. */
rpmdbMatchIterator mi;
@@ -132,14 +131,9 @@ static rpmRC rpmgiLoadReadHeader(rpmgi gi)
if (gi->argv != NULL && gi->argv[gi->i] != NULL)
do {
- char * fn; /* XXX gi->hdrPath? */
-
- fn = gi->argv[gi->i];
- if (!(gi->flags & RPMGI_NOHEADER)) {
- h = rpmgiReadHeader(gi, fn);
- if (h != NULL)
- rpmrc = RPMRC_OK;
- } else
+ char * fn = gi->argv[gi->i];
+ h = rpmgiReadHeader(gi, fn);
+ if (h != NULL)
rpmrc = RPMRC_OK;
if (rpmrc == RPMRC_OK || gi->flags & RPMGI_NOMANIFEST)
@@ -267,7 +261,6 @@ rpmgi rpmgiFree(rpmgi gi)
if (gi == NULL)
return NULL;
- gi->hdrPath = _free(gi->hdrPath);
gi->h = headerFree(gi->h);
gi->argv = argvFree(gi->argv);
@@ -296,7 +289,6 @@ rpmgi rpmgiNew(rpmts ts, rpmTag tag, const void * keyp, size_t keylen)
gi->active = 0;
gi->i = -1;
gi->errors = 0;
- gi->hdrPath = NULL;
gi->h = NULL;
gi->mi = NULL;
@@ -308,7 +300,6 @@ rpmgi rpmgiNew(rpmts ts, rpmTag tag, const void * keyp, size_t keylen)
rpmRC rpmgiNext(rpmgi gi)
{
- char hnum[32];
rpmRC rpmrc = RPMRC_NOTFOUND;
if (gi == NULL)
@@ -316,8 +307,6 @@ rpmRC rpmgiNext(rpmgi gi)
/* Free header from previous iteration. */
gi->h = headerFree(gi->h);
- gi->hdrPath = _free(gi->hdrPath);
- hnum[0] = '\0';
if (++gi->i >= 0)
switch (gi->tag) {
@@ -332,10 +321,7 @@ rpmRC rpmgiNext(rpmgi gi)
if (gi->mi != NULL) { /* XXX unnecessary */
Header h = rpmdbNextIterator(gi->mi);
if (h != NULL) {
- if (!(gi->flags & RPMGI_NOHEADER))
- gi->h = headerLink(h);
- sprintf(hnum, "%u", rpmdbGetIteratorOffset(gi->mi));
- gi->hdrPath = rpmExpand("rpmdb h# ", hnum, NULL);
+ gi->h = headerLink(h);
rpmrc = RPMRC_OK;
/* XXX header reference held by iterator, so no headerFree */
} else
@@ -365,7 +351,6 @@ fprintf(stderr, "*** gi %p\t%p[%d]: %s\n", gi, gi->argv, gi->i, gi->argv[gi->i])
if (rpmrc != RPMRC_OK) /* XXX check this */
goto enditer;
- gi->hdrPath = xstrdup(gi->argv[gi->i]);
break;
}
@@ -374,17 +359,11 @@ fprintf(stderr, "*** gi %p\t%p[%d]: %s\n", gi, gi->argv, gi->i, gi->argv[gi->i])
enditer:
gi->mi = rpmdbFreeIterator(gi->mi);
gi->h = headerFree(gi->h);
- gi->hdrPath = _free(gi->hdrPath);
gi->i = -1;
gi->active = 0;
return rpmrc;
}
-const char * rpmgiHdrPath(rpmgi gi)
-{
- return (gi != NULL ? gi->hdrPath : NULL);
-}
-
Header rpmgiHeader(rpmgi gi)
{
return (gi != NULL ? gi->h : NULL);