From e43ec608749a44a305afec89f46bcb282ab93d10 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 21 Feb 2011 15:31:39 +0000 Subject: [PATCH] state: use db in own struc when committing The db parameter to apk_state_commit is not needed so we remove it. --- src/add.c | 2 +- src/apk_state.h | 2 +- src/del.c | 2 +- src/fix.c | 2 +- src/state.c | 4 ++-- src/upgrade.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/add.c b/src/add.c index 977c772..d63f61d 100644 --- a/src/add.c +++ b/src/add.c @@ -142,7 +142,7 @@ static int add_main(void *ctx, struct apk_database *db, int argc, char **argv) apk_state_print_errors(state); r = -1; } else { - r = apk_state_commit(state, db); + r = apk_state_commit(state); } if (state != NULL) apk_state_unref(state); diff --git a/src/apk_state.h b/src/apk_state.h index 1ac049a..e0df54e 100644 --- a/src/apk_state.h +++ b/src/apk_state.h @@ -37,7 +37,7 @@ struct apk_state *apk_state_dup(struct apk_state *state); void apk_state_unref(struct apk_state *state); void apk_state_print_errors(struct apk_state *state); -int apk_state_commit(struct apk_state *state, struct apk_database *db); +int apk_state_commit(struct apk_state *state); int apk_state_lock_dependency(struct apk_state *state, struct apk_dependency *dep); int apk_state_lock_name(struct apk_state *state, diff --git a/src/del.c b/src/del.c index 695785f..4c00ade 100644 --- a/src/del.c +++ b/src/del.c @@ -58,7 +58,7 @@ static int del_main(void *ctx, struct apk_database *db, int argc, char **argv) r |= apk_state_lock_dependency(state, &dep); } if (r == 0) - r = apk_state_commit(state, db); + r = apk_state_commit(state); else apk_state_print_errors(state); err: diff --git a/src/fix.c b/src/fix.c index 1bacce2..48cab9c 100644 --- a/src/fix.c +++ b/src/fix.c @@ -89,7 +89,7 @@ static int fix_main(void *pctx, struct apk_database *db, int argc, char **argv) r |= apk_state_lock_dependency(state, &deps[i]); if (r == 0 || (apk_flags & APK_FORCE)) - r = apk_state_commit(state, db); + r = apk_state_commit(state); else apk_state_print_errors(state); err: diff --git a/src/state.c b/src/state.c index fef1cbb..d63e1bf 100644 --- a/src/state.c +++ b/src/state.c @@ -937,11 +937,11 @@ void apk_state_print_errors(struct apk_state *state) printf("\n"); } -int apk_state_commit(struct apk_state *state, - struct apk_database *db) +int apk_state_commit(struct apk_state *state) { struct progress prog; struct apk_change *change; + struct apk_database *db = state->db; int n = 0, r = 0, size_diff = 0, toplevel = FALSE, deleteonly = TRUE; /* Count what needs to be done */ diff --git a/src/upgrade.c b/src/upgrade.c index eb51457..4db0c00 100644 --- a/src/upgrade.c +++ b/src/upgrade.c @@ -48,7 +48,7 @@ int apk_do_self_upgrade(struct apk_database *db, struct apk_state *state) apk_message("Uprading first to new apk-tools:"); state->print_ok = 0; - r = apk_state_commit(state, db); + r = apk_state_commit(state); apk_state_unref(state); apk_db_close(db); @@ -101,7 +101,7 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg if (i != 0) printf("\n"); - r = apk_state_commit(state, db); + r = apk_state_commit(state); } else apk_state_print_errors(state); err: