Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add find utilities.
Vsevolod Stakhov committed 11 years ago
commit 4d49c01bda833d1a478f7ca43524ce902494afe8
parent e53c5ec
2 files changed +32 -0
modified libpkg/pkg_jobs_universe.c
@@ -698,3 +698,23 @@ pkg_jobs_universe_new(struct pkg_jobs *j)

	return (universe);
}
+

+
struct pkg_job_universe_item *
+
pkg_jobs_universe_find(struct pkg_jobs_universe *universe, const char *uid)
+
{
+
	struct pkg_job_universe_item *unit;
+

+
	HASH_FIND_STR(universe->items, uid, unit);
+

+
	return (unit);
+
}
+

+
bool
+
pkg_jobs_universe_seen(struct pkg_jobs_universe *universe, const char *digest)
+
{
+
	struct pkg_job_seen *seen;
+

+
	HASH_FIND_STR(universe->seen, digest, seen);
+

+
	return (seen != NULL);
+
}
modified libpkg/private/pkg_jobs.h
@@ -156,4 +156,16 @@ int pkg_jobs_universe_process_package(struct pkg_jobs_universe *universe,
void pkg_jobs_add_req(struct pkg_jobs *j, const char *uid,
	struct pkg_job_universe_item *item);

+
/*
+
 * Check if the specified digest was seen in the universe
+
 */
+
bool pkg_jobs_universe_seen(struct pkg_jobs_universe *universe,
+
	const char *digest);
+

+
/*
+
 * Search for an entry corresponding to the uid in the universe
+
 */
+
struct pkg_job_universe_item * pkg_jobs_universe_find(struct pkg_jobs_universe
+
	*universe, const char *uid);
+

#endif /* PKG_JOBS_H_ */