summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/query.c17
-rw-r--r--lib/rpmgi.c24
-rw-r--r--lib/rpmgi.h18
3 files changed, 13 insertions, 46 deletions
diff --git a/lib/query.c b/lib/query.c
index d3f92b2cc..9cf270847 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -531,19 +531,6 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
return res;
}
-static int rpmcliArgIterHelper(rpmts ts, QVA_t qva, rpmTag tag, ARGV_const_t argv, rpmgiFlags gFlgs)
-{
- int ec = 0;
-
- qva->qva_gi = rpmgiNew(ts, tag, NULL, 0);
- rpmgiSetArgs(qva->qva_gi, argv, gFlgs);
-
- /* FIX: argv can be NULL, cast to pass argv array */
- ec = rpmQueryVerify(qva, ts, (tag == RPMDBI_PACKAGES)? (const char *) argv : NULL);
- qva->qva_gi = rpmgiFree(qva->qva_gi);
- return ec;
-}
-
/*
* Apply extra query filters. By default patterns applied to package
* name, others can be specified with <tagname>=<pattern>
@@ -596,7 +583,9 @@ int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
}
break;
case RPMQV_RPM:
- ec = rpmcliArgIterHelper(ts, qva, RPMDBI_ARGLIST, argv, giFlags);
+ qva->qva_gi = rpmgiNew(ts, giFlags, argv);
+ ec = rpmQueryVerify(qva, ts, NULL);
+ qva->qva_gi = rpmgiFree(qva->qva_gi);
break;
default:
for (ARGV_const_t arg = argv; arg && *arg; arg++)
diff --git a/lib/rpmgi.c b/lib/rpmgi.c
index d015de22d..92a356dcd 100644
--- a/lib/rpmgi.c
+++ b/lib/rpmgi.c
@@ -162,12 +162,10 @@ static rpmRC rpmgiLoadReadHeader(rpmgi gi)
* Append globbed arg list to iterator.
* @param gi generalized iterator
* @param argv arg list to be globbed (or NULL)
- * @returns RPMRC_OK on success
*/
-static rpmRC rpmgiGlobArgv(rpmgi gi, ARGV_const_t argv)
+static void rpmgiGlobArgv(rpmgi gi, ARGV_const_t argv)
{
const char * arg;
- rpmRC rpmrc = RPMRC_OK;
int ac = 0;
int xx;
@@ -176,11 +174,10 @@ static rpmRC rpmgiGlobArgv(rpmgi gi, ARGV_const_t argv)
if (argv != NULL) {
while (argv[ac] != NULL)
ac++;
-/* XXX argv is not NULL */
xx = argvAppend(&gi->argv, argv);
}
gi->argc = ac;
- return rpmrc;
+ return;
}
if (argv != NULL)
@@ -195,7 +192,7 @@ static rpmRC rpmgiGlobArgv(rpmgi gi, ARGV_const_t argv)
t = _free(t);
ac = 0;
}
- return rpmrc;
+ return;
}
rpmgi rpmgiFree(rpmgi gi)
@@ -212,23 +209,22 @@ rpmgi rpmgiFree(rpmgi gi)
return NULL;
}
-rpmgi rpmgiNew(rpmts ts, rpmTag tag, const void * keyp, size_t keylen)
+rpmgi rpmgiNew(rpmts ts, rpmgiFlags flags, ARGV_const_t argv)
{
rpmgi gi = xcalloc(1, sizeof(*gi));
- if (gi == NULL)
- return NULL;
-
gi->ts = rpmtsLink(ts, __FUNCTION__);
- gi->flags = 0;
+ gi->flags = flags;
gi->active = 0;
gi->i = -1;
gi->errors = 0;
gi->h = NULL;
+ gi->flags = flags;
gi->argv = argvNew();
gi->argc = 0;
+ rpmgiGlobArgv(gi, argv);
return gi;
}
@@ -274,12 +270,6 @@ Header rpmgiHeader(rpmgi gi)
return (gi != NULL ? gi->h : NULL);
}
-rpmRC rpmgiSetArgs(rpmgi gi, ARGV_const_t argv, rpmgiFlags flags)
-{
- gi->flags = flags;
- return rpmgiGlobArgv(gi, argv);
-}
-
int rpmgiNumErrors(rpmgi gi)
{
return (gi != NULL ? gi->errors : -1);
diff --git a/lib/rpmgi.h b/lib/rpmgi.h
index 29456ae81..f2bf286dc 100644
--- a/lib/rpmgi.h
+++ b/lib/rpmgi.h
@@ -36,13 +36,11 @@ rpmgi rpmgiFree(rpmgi gi);
/** \ingroup rpmgi
* Return a generalized iterator.
* @param ts transaction set
- * @param tag rpm tag
- * @param keyp key data (NULL for sequential access)
- * @param keylen key data length (0 will use strlen(keyp))
+ * @param flags iterator flags
+ * @param argv arg list
* @return new iterator
*/
-rpmgi rpmgiNew(rpmts ts, rpmTag tag, const void * keyp,
- size_t keylen);
+rpmgi rpmgiNew(rpmts ts, rpmgiFlags flags, ARGV_const_t argv);
/** \ingroup rpmgi
* Perform next iteration step.
@@ -59,16 +57,6 @@ rpmRC rpmgiNext(rpmgi gi);
Header rpmgiHeader(rpmgi gi);
/** \ingroup rpmgi
- * Load iterator args.
- * @param gi generalized iterator
- * @param argv arg list
- * @param flags iterator flags
- * @return RPMRC_OK on success
- */
-rpmRC rpmgiSetArgs(rpmgi gi, ARGV_const_t argv, rpmgiFlags flags);
-
-
-/** \ingroup rpmgi
* Return number of errors (file not found etc) encountered during iteration
* @param gi generalized iterator
* @return number of errors