diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2006-03-07 21:01:02 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2006-03-07 21:01:02 +0000 |
commit | 5d7dcdd22cd71f8604cf6d784655474c4058cb85 (patch) | |
tree | 672820ca206618e8270721102179ce374479111f | |
parent | 021bf7b0d0cde84f6ea1e1a8d2eca069b2ef4e70 (diff) | |
download | pacman-5d7dcdd22cd71f8604cf6d784655474c4058cb85.tar.xz |
removed db_scan calls
-rw-r--r-- | lib/libalpm/conflict.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index f3b1f1f8..53feabab 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -221,6 +221,11 @@ PMList *_alpm_db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList } if(_alpm_list_is_strin(filestr, p2->files)) { pmconflict_t *conflict = malloc(sizeof(pmconflict_t)); + if(conflict == NULL) { + _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", + sizeof(pmconflict_t)); + continue; + } conflict->type = PM_CONFLICT_TYPE_TARGET; STRNCPY(conflict->target, p1->name, PKG_NAME_LEN); STRNCPY(conflict->file, filestr, CONFLICT_FILE_LEN); @@ -261,7 +266,11 @@ PMList *_alpm_db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList ok = 1; } else { if(dbpkg == NULL) { - dbpkg = _alpm_db_scan(db, p->name, INFRQ_DESC | INFRQ_FILES); + dbpkg = _alpm_db_get_pkgfromcache(db, p->name); + } + if(dbpkg && !(dbpkg->infolevel & INFRQ_FILES)) { + _alpm_log(PM_LOG_DEBUG, "loading FILES info for '%s'", dbpkg->name); + _alpm_db_read(db, INFRQ_FILES, dbpkg); } if(dbpkg && _alpm_list_is_strin(j->data, dbpkg->files)) { ok = 1; @@ -288,7 +297,11 @@ PMList *_alpm_db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList /* As long as they're not the current package */ if(strcmp(p1->name, p->name)) { pmpkg_t *dbpkg2 = NULL; - dbpkg2 = _alpm_db_scan(db, p1->name, INFRQ_DESC | INFRQ_FILES); + dbpkg2 = _alpm_db_get_pkgfromcache(db, p1->name); + if(dbpkg2 && !(dbpkg2->infolevel & INFRQ_FILES)) { + _alpm_log(PM_LOG_DEBUG, "loading FILES info for '%s'", dbpkg2->name); + _alpm_db_read(db, INFRQ_FILES, dbpkg2); + } /* If it used to exist in there, but doesn't anymore */ if(dbpkg2 && !_alpm_list_is_strin(filestr, p1->files) && _alpm_list_is_strin(filestr, dbpkg2->files)) { ok = 1; @@ -318,6 +331,11 @@ PMList *_alpm_db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList donecheck: if(!ok) { pmconflict_t *conflict = malloc(sizeof(pmconflict_t)); + if(conflict == NULL) { + _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", + sizeof(pmconflict_t)); + continue; + } conflict->type = PM_CONFLICT_TYPE_FILE; STRNCPY(conflict->target, p->name, PKG_NAME_LEN); STRNCPY(conflict->file, filestr, CONFLICT_FILE_LEN); @@ -326,7 +344,6 @@ donecheck: } } } - FREEPKG(dbpkg); } return(conflicts); |