fix misc compiler warnings about unintialized variables.

The compiler is actually right about those.
cute-signatures
Natanael Copa 2009-05-11 12:17:35 +00:00
parent 110611c53c
commit ade1841541
2 changed files with 4 additions and 3 deletions

View File

@ -40,7 +40,7 @@ static int add_main(void *ctx, int argc, char **argv)
{ {
struct add_ctx *actx = (struct add_ctx *) ctx; struct add_ctx *actx = (struct add_ctx *) ctx;
struct apk_database db; struct apk_database db;
struct apk_state *state; struct apk_state *state = NULL;
struct apk_dependency_array *pkgs; /* list of pkgs to install */ struct apk_dependency_array *pkgs; /* list of pkgs to install */
int i, r; int i, r;
@ -86,7 +86,8 @@ static int add_main(void *ctx, int argc, char **argv)
} }
r = apk_state_commit(state, &db); r = apk_state_commit(state, &db);
err: err:
apk_state_unref(state); if (state != NULL)
apk_state_unref(state);
apk_db_close(&db); apk_db_close(&db);
return r; return r;
} }

View File

@ -19,7 +19,7 @@ static int del_main(void *ctx, int argc, char **argv)
struct apk_database db; struct apk_database db;
struct apk_state *state; struct apk_state *state;
struct apk_name *name; struct apk_name *name;
int i, r; int i, r = 0;
if (apk_db_open(&db, apk_root, APK_OPENF_WRITE) < 0) if (apk_db_open(&db, apk_root, APK_OPENF_WRITE) < 0)
return -1; return -1;