Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=b89a330d4be43211800398398c91f43008b0d5f2
commit b89a330d4be43211800398398c91f43008b0d5f2 Author: Michel Hermier <[email protected]> Date: Mon Dec 9 20:20:39 2013 +0100 libpacman: Simplify _pacman_db_free_grpcache. diff --git a/lib/libpacman/cache.c b/lib/libpacman/cache.c index 79e6e30..09264c8 100644 --- a/lib/libpacman/cache.c +++ b/lib/libpacman/cache.c @@ -223,21 +223,15 @@ int _pacman_db_load_grpcache(pmdb_t *db) void _pacman_db_free_grpcache(pmdb_t *db) { - pmlist_t *lg; + FVisitor visitor = { + .fn = (FVisitorFunc)_pacman_grp_delete, + .data = NULL, + }; ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); - if(f_ptrlist_empty(db->grpcache)) { - return; - } - for(lg = db->grpcache; lg; lg = lg->next) { - pmgrp_t *grp = lg->data; - - FREELISTPTR(grp->packages); - _pacman_grp_delete(grp); - lg->data = NULL; - } - FREELIST(db->grpcache); + f_ptrlist_clear(db->grpcache, &visitor); + db->grpcache = NULL; } pmlist_t *_pacman_db_get_grpcache(pmdb_t *db) _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
