Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
libpkg: Fix some style bugs, simplify control flow, add comments
Mark Johnston committed 4 years ago
commit c373cf98112561c3f56dc4c37a5e74efd8890537
parent f9ce762
3 files changed +8 -11
modified libpkg/pkg_jobs.c
@@ -2372,8 +2372,7 @@ pkg_jobs_fetch(struct pkg_jobs *j)

	/* Fetch */
	DL_FOREACH(j->jobs, ps) {
-
		if (ps->type != PKG_SOLVED_DELETE
-
						&& ps->type != PKG_SOLVED_UPGRADE_REMOVE) {
+
		if (ps->type != PKG_SOLVED_DELETE && ps->type != PKG_SOLVED_UPGRADE_REMOVE) {
			p = ps->items[0]->pkg;
			if (p->type != PKG_REMOTE)
				continue;
modified libpkg/pkg_solve.c
@@ -859,16 +859,16 @@ pkg_solve_jobs_to_sat(struct pkg_jobs *j)
	while (pkghash_next(&it)) {
		un = (struct pkg_job_universe_item *)it.value;
		/* Add corresponding variables */
-
		if (pkg_solve_add_variable(un, problem, &i)
-
						== EPKG_FATAL)
+
		if (pkg_solve_add_variable(un, problem, &i) == EPKG_FATAL)
			goto err;
	}

	/* Add rules for all conflict chains */
	it = pkghash_iterator(j->universe->items);
	while (pkghash_next(&it)) {
+
		struct pkg_solve_variable *var;
+

		un = (struct pkg_job_universe_item *)it.value;
-
		struct pkg_solve_variable *var = NULL;
		var = pkghash_get_value(problem->variables_by_uid, un->pkg->uid);
		if (var == NULL) {
			pkg_emit_error("internal solver error: variable %s is not found",
@@ -879,10 +879,8 @@ pkg_solve_jobs_to_sat(struct pkg_jobs *j)
			goto err;
	}

-
	if (kv_size(problem->rules) == 0) {
+
	if (kv_size(problem->rules) == 0)
		pkg_debug(1, "problem has no requests");
-
		return (problem);
-
	}

	return (problem);

modified libpkg/private/pkg_jobs.h
@@ -79,9 +79,9 @@ struct pkg_job_replace {
};

struct pkg_jobs_universe {
-
	pkghash *items;
-
	pkghash *seen;
-
	pkghash *provides;
+
	pkghash *items;		/* package uid, pkg_job_universe_item */
+
	pkghash *seen;		/* package digest, pkg_job_universe_item */
+
	pkghash *provides;	/* shlibs, pkg_job_provide */
	struct pkg_job_replace *uid_replaces;
	struct pkg_jobs *j;
	size_t nitems;