summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/pkghash.c
AgeCommit message (Collapse)AuthorFilesLines
2011-02-04Improve pkghash_remove algorithmDan McGee1-19/+43
Rather than potentially move every item to the next NULL, attempt to move at most one item at a time by iterating backwards from the NULL location in the hash array. If we move an item, we repeat the process on the now shorter "chain" until no more items need moving. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04Use alpm_list_remove_item in pkghash_removeDan McGee1-31/+4
Removes the code that was duplicated and has now been refactored into a separate method. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04Actually remove packages from pkghash on removalAllan McRae1-8/+29
Fully removes a package from the hash. Also unify prototype with removal from an alpm_list_t, fixing issues when removing a package from the pkgcache. Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04Refactor finding position for new hash entryAllan McRae1-19/+18
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04Rehash efficientlyAllan McRae1-3/+21
Rehash without recreating the hash table list or reallocating the memory for holding the list nodes. Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04Slightly more efficient rehash size selectionAllan McRae1-2/+4
While probably still not optimal in terms of everyday usage in pacman, this reduces the absolute size increase to "more reasonable" levels. For databases greater than 5000 in size, the minimum size increase is used which is still on the order of a 10% increase. Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04Error handling for maximum database sizeAllan McRae1-0/+12
Check that the requested size of a pkghash is not beyond the maximum prime. Also check for successful creation of a new hash before rehashing. Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04Implement a quick and dirty rehash functionDan McGee1-11/+16
This allows us to get through the rehash required by smoke001 and pass all pactests. It is by no means the best or most efficient implementation but it does do the job. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04Add a hash table for holding packagesAllan McRae1-0/+292
Signed-off-by: Allan McRae <allan@archlinux.org>