diff options
Diffstat (limited to 'lib/dpkg/pkg-array.c')
-rw-r--r-- | lib/dpkg/pkg-array.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/dpkg/pkg-array.c b/lib/dpkg/pkg-array.c index 24c6dc0e2..0ce285e92 100644 --- a/lib/dpkg/pkg-array.c +++ b/lib/dpkg/pkg-array.c @@ -22,7 +22,6 @@ #include <config.h> #include <compat.h> -#include <assert.h> #include <string.h> #include <stdlib.h> @@ -60,21 +59,23 @@ pkg_array_init_from_names(struct pkg_array *a, pkg_mapper_func pkg_mapper, * @param a The array to initialize. */ void -pkg_array_init_from_db(struct pkg_array *a) +pkg_array_init_from_hash(struct pkg_array *a) { - struct pkgiterator *iter; + struct pkg_hash_iter *iter; struct pkginfo *pkg; int i; - a->n_pkgs = pkg_db_count_pkg(); + a->n_pkgs = pkg_hash_count_pkg(); a->pkgs = m_malloc(sizeof(a->pkgs[0]) * a->n_pkgs); - iter = pkg_db_iter_new(); - for (i = 0; (pkg = pkg_db_iter_next_pkg(iter)); i++) + iter = pkg_hash_iter_new(); + for (i = 0; (pkg = pkg_hash_iter_next_pkg(iter)); i++) a->pkgs[i] = pkg; - pkg_db_iter_free(iter); + pkg_hash_iter_free(iter); - assert(i == a->n_pkgs); + if (i != a->n_pkgs) + internerr("inconsistent state in pkg array: i=%d != npkgs=%d", + i, a->n_pkgs); } /** |