From e24c22e308f3dfc0642a542ff2fd7158af489fd0 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 3 Mar 2007 09:43:16 +0000 Subject: * A little more hacking with wchar_t output, but nothing really changed in it. Eventually we'll make progress. * Rewrote the _alpm_splitdep function to behave more like all our other function calls. Use heap instead of stack allocation for the depend struct, so now it needs to be freed by the caller. --- lib/libalpm/package.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/libalpm/package.c') diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index f720bd7f..1faf2f2d 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -546,16 +546,17 @@ void _alpm_pkg_update_requiredby(pmpkg_t *pkg) } pmpkg_t *cachepkg = i->data; for(j = alpm_pkg_get_depends(cachepkg); j; j = j->next) { - pmdepend_t dep; + pmdepend_t *dep; if(!j->data) { continue; } - if(_alpm_splitdep(j->data, &dep) != 0) { - continue; + dep = _alpm_splitdep(j->data); + if(dep == NULL) { + continue; } - + /* check the actual package itself */ - if(strcmp(dep.name, alpm_pkg_get_name(pkg)) == 0) { + if(strcmp(dep->name, alpm_pkg_get_name(pkg)) == 0) { _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), cachepkg->name, pkg->name); alpm_list_t *reqs = alpm_pkg_get_requiredby(pkg); @@ -566,7 +567,7 @@ void _alpm_pkg_update_requiredby(pmpkg_t *pkg) /* check for provisions as well */ for(k = alpm_pkg_get_provides(pkg); k; k = k->next) { const char *provname = k->data; - if(strcmp(dep.name, provname) == 0) { + if(strcmp(dep->name, provname) == 0) { _alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s' (provides: %s)"), alpm_pkg_get_name(cachepkg), alpm_pkg_get_name(pkg), provname); alpm_list_t *reqs = alpm_pkg_get_requiredby(pkg); @@ -574,6 +575,7 @@ void _alpm_pkg_update_requiredby(pmpkg_t *pkg) pkg->requiredby = reqs; } } + free(dep); } } } -- cgit v1.2.3-54-g00ecf