diff options
author | Timo Teräs <timo.teras@iki.fi> | 2010-06-08 14:26:35 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2010-06-08 14:26:35 +0300 |
commit | 8ac170c49db4782531b0d13eb534e3df53951969 (patch) | |
tree | 82131ddc477dc2b80cceab6192bd33c48fd4cd3b | |
parent | efe90d43c8de624f771d726d8412bfbc30002afa (diff) | |
download | apk-tools-8ac170c49db4782531b0d13eb534e3df53951969.tar.bz2 apk-tools-8ac170c49db4782531b0d13eb534e3df53951969.tar.xz |
info: fix usage of arrays
-rw-r--r-- | src/info.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -98,10 +98,11 @@ static int info_who_owns(struct info_ctx *ctx, struct apk_database *db, int argc, char **argv) { struct apk_package *pkg; - struct apk_dependency_array *deps = NULL; + struct apk_dependency_array *deps; struct apk_dependency dep; int i; + apk_dependency_array_init(&deps); for (i = 0; i < argc; i++) { pkg = apk_db_get_file_owner(db, APK_BLOB_STR(argv[i])); if (pkg == NULL) @@ -118,16 +119,15 @@ static int info_who_owns(struct info_ctx *ctx, struct apk_database *db, pkg->name->name, pkg->version); } } - if (apk_verbosity < 1 && deps != NULL) { + if (apk_verbosity < 1 && deps->num != 0) { struct apk_ostream *os; os = apk_ostream_to_fd(STDOUT_FILENO); apk_deps_write(deps, os); os->write(os, "\n", 1); os->close(os); - - free(deps); } + apk_dependency_array_free(&deps); return 0; } |