state: use db in own struc when committing

The db parameter to apk_state_commit is not needed so we remove it.
cute-signatures
Natanael Copa 2011-02-21 15:31:39 +00:00
parent 0f6475b884
commit e43ec60874
6 changed files with 8 additions and 8 deletions

View File

@ -142,7 +142,7 @@ static int add_main(void *ctx, struct apk_database *db, int argc, char **argv)
apk_state_print_errors(state); apk_state_print_errors(state);
r = -1; r = -1;
} else { } else {
r = apk_state_commit(state, db); r = apk_state_commit(state);
} }
if (state != NULL) if (state != NULL)
apk_state_unref(state); apk_state_unref(state);

View File

@ -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_unref(struct apk_state *state);
void apk_state_print_errors(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, int apk_state_lock_dependency(struct apk_state *state,
struct apk_dependency *dep); struct apk_dependency *dep);
int apk_state_lock_name(struct apk_state *state, int apk_state_lock_name(struct apk_state *state,

View File

@ -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); r |= apk_state_lock_dependency(state, &dep);
} }
if (r == 0) if (r == 0)
r = apk_state_commit(state, db); r = apk_state_commit(state);
else else
apk_state_print_errors(state); apk_state_print_errors(state);
err: err:

View File

@ -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]); r |= apk_state_lock_dependency(state, &deps[i]);
if (r == 0 || (apk_flags & APK_FORCE)) if (r == 0 || (apk_flags & APK_FORCE))
r = apk_state_commit(state, db); r = apk_state_commit(state);
else else
apk_state_print_errors(state); apk_state_print_errors(state);
err: err:

View File

@ -937,11 +937,11 @@ void apk_state_print_errors(struct apk_state *state)
printf("\n"); printf("\n");
} }
int apk_state_commit(struct apk_state *state, int apk_state_commit(struct apk_state *state)
struct apk_database *db)
{ {
struct progress prog; struct progress prog;
struct apk_change *change; struct apk_change *change;
struct apk_database *db = state->db;
int n = 0, r = 0, size_diff = 0, toplevel = FALSE, deleteonly = TRUE; int n = 0, r = 0, size_diff = 0, toplevel = FALSE, deleteonly = TRUE;
/* Count what needs to be done */ /* Count what needs to be done */

View File

@ -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:"); apk_message("Uprading first to new apk-tools:");
state->print_ok = 0; state->print_ok = 0;
r = apk_state_commit(state, db); r = apk_state_commit(state);
apk_state_unref(state); apk_state_unref(state);
apk_db_close(db); 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) if (i != 0)
printf("\n"); printf("\n");
r = apk_state_commit(state, db); r = apk_state_commit(state);
} else } else
apk_state_print_errors(state); apk_state_print_errors(state);
err: err: