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>
}
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++)
* 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;
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)
t = _free(t);
ac = 0;
}
- return rpmrc;
+ return;
}
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;
}
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);
/** \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.
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