From a628feee46f2200db7d3303091813f050a61d0a3 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 9 Aug 2011 01:00:16 -0500 Subject: Parse conflicts/provides/replaces at database load time We did this with depends way back in commit c244cfecf654d3 in 2007. We can do it with these fields as well. Of note is the inclusion of provides even though only '=' is supported- we'll parse other things, but no guarantees are given as to behavior, which is more or less similar to before since we only looked for the equals sign. Also of note is the non-inclusion of optdepends; this will likely be resolved down the road. The biggest benefactors of this change will be the resolving code that formerly had to parse and reparse several of these fields; it only happens once now at load time. This does lead to the disadvantage that we will now always be parsing this information up front even if we never need it in the split form, but as these are uncommon fields and our parser is quite efficient it shouldn't be a big concern. Signed-off-by: Dan McGee --- lib/libalpm/sync.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/libalpm/sync.c') diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index f16489d9..3e38707e 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -150,14 +150,11 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade) for(k = _alpm_db_get_pkgcache(sdb); k; k = k->next) { spkg = k->data; for(l = alpm_pkg_get_replaces(spkg); l; l = l->next) { - const char *replace = l->data; - alpm_depend_t *parsed_replace = _alpm_splitdep(replace); - if(_alpm_depcmp(lpkg, parsed_replace)) { + alpm_depend_t *replace = l->data; + if(_alpm_depcmp(lpkg, replace)) { found = 1; - _alpm_dep_free(parsed_replace); break; } - _alpm_dep_free(parsed_replace); } if(found) { /* check IgnorePkg/IgnoreGroup */ -- cgit v1.2.3-2-g168b