From a59f48585f7ca5fc27cac77b9179d95e249d4ca6 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 16 Oct 2011 10:03:27 +0200 Subject: [PATCH] repository_pool_find_pkg: added some dbg printf, calloc -> malloc. There's no need to use calloc here because some members are being initialized anyway, so fully initialize all members and skip the memset syscall via calloc. --- lib/repository_pool.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/repository_pool.c b/lib/repository_pool.c index d775017a..5c2baf94 100644 --- a/lib/repository_pool.c +++ b/lib/repository_pool.c @@ -278,6 +278,10 @@ repo_find_virtualpkg_cb(struct repository_pool_index *rpi, void *arg, bool *done "packages", rpf->pattern); } if (rpf->pkgd) { +#ifdef DEBUG + xbps_dbg_printf("%s: found pkg in repository\n", __func__); + xbps_dbg_printf_append("%s", prop_dictionary_externalize(rpf->pkgd)); +#endif prop_dictionary_set_cstring(rpf->pkgd, "repository", rpi->rpi_uri); *done = true; @@ -315,6 +319,10 @@ repo_find_pkg_cb(struct repository_pool_index *rpi, void *arg, bool *done) * Package dictionary found, add the "repository" * object with the URI. */ +#ifdef DEBUG + xbps_dbg_printf("%s: found pkg in repository\n", __func__); + xbps_dbg_printf_append("%s", prop_dictionary_externalize(rpf->pkgd)); +#endif prop_dictionary_set_cstring(rpf->pkgd, "repository", rpi->rpi_uri); *done = true; @@ -388,12 +396,14 @@ xbps_repository_pool_find_pkg(const char *pkg, bool bypattern, bool best) assert(pkg != NULL); - rpf = calloc(1, sizeof(*rpf)); + rpf = malloc(sizeof(*rpf)); if (rpf == NULL) return NULL; rpf->pattern = pkg; rpf->bypattern = bypattern; + rpf->pkgfound = false; + rpf->pkgd = NULL; if (best) { /*