Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Implement a function for resetting the pkgdb_it iterator
Marin Atanasov Nikolov committed 12 years ago
commit 27fe14fa3bb522f12d24beed66f740085f214f44
parent fb7edb4
2 files changed +14 -0
modified libpkg/pkg.h.in
@@ -1020,6 +1020,11 @@ int pkgdb_delete_annotation(struct pkgdb *db, const char *pkgname,
int pkgdb_it_next(struct pkgdb_it *, struct pkg **pkg, unsigned flags);

/**
+
 * Reset the pkgdb_it iterator, allowing for re-iterating over it
+
 */
+
void pkgdb_it_reset(struct pkgdb_it *);
+

+
/**
 * Free a struct pkgdb_it.
 */
void pkgdb_it_free(struct pkgdb_it *);
modified libpkg/pkgdb.c
@@ -1337,6 +1337,15 @@ pkgdb_it_next(struct pkgdb_it *it, struct pkg **pkg_p, unsigned flags)
}

void
+
pkgdb_it_reset(struct pkgdb_it *it)
+
{
+
	if (it == NULL)
+
		return;
+

+
	it->finished = 0;
+
}
+

+
void
pkgdb_it_free(struct pkgdb_it *it)
{
	if (it == NULL)