Remove FREELISTPTR macro

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-04-28 03:54:25 -04:00
parent a8b683d8e2
commit a57b2f233f
7 changed files with 20 additions and 22 deletions

View File

@ -249,7 +249,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
_alpm_log(PM_LOG_DEBUG, _("sorting by dependencies"));
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_ADD);
/* free the old alltargs */
FREELISTPTR(trans->packages);
alpm_list_free(trans->packages);
trans->packages = lp;
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);

View File

@ -43,10 +43,7 @@ struct __alpm_list_t {
struct __alpm_list_t *next;
};
/* TODO we should do away with these... they're messy*/
#define _FREELIST(p, f) do { alpm_list_free_inner(p, f); alpm_list_free(p); p = NULL; } while(0)
#define FREELIST(p) _FREELIST(p, free)
#define FREELISTPTR(p) do { alpm_list_free(p); p = NULL; } while(0)
#define FREELIST(p) do { alpm_list_free_inner(p, free); alpm_list_free(p); p = NULL; } while(0)
typedef void (*alpm_list_fn_free)(void *); /* item deallocation callback */
typedef int (*alpm_list_fn_cmp)(const void *, const void *); /* item comparison callback */

View File

@ -254,7 +254,8 @@ void _alpm_db_free_grpcache(pmdb_t *db)
for(lg = db->grpcache; lg; lg = lg->next) {
pmgrp_t *grp = lg->data;
FREELISTPTR(grp->packages);
alpm_list_free(grp->packages);
grp->packages = NULL;
_alpm_grp_free(lg->data);
lg->data = NULL;
}

View File

@ -176,7 +176,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
tmptargs = alpm_list_add(tmptargs, p);
}
}
FREELISTPTR(newtargs);
alpm_list_free(newtargs);
newtargs = tmptargs;
}
_alpm_log(PM_LOG_DEBUG, _("sorting dependencies finished"));
@ -185,7 +185,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
/* we're removing packages, so reverse the order */
alpm_list_t *tmptargs = alpm_list_reverse(newtargs);
/* free the old one */
FREELISTPTR(newtargs);
alpm_list_free(newtargs);
newtargs = tmptargs;
}
@ -346,7 +346,6 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
found = alpm_depcmp(p, depend);
}
FREELISTPTR(k);
}
/* check other targets */
for(k = packages; k && !found; k = k->next) {
@ -543,7 +542,7 @@ alpm_list_t *_alpm_removedeps(pmdb_t *db, alpm_list_t *targs)
newtargs = _alpm_removedeps(db, newtargs);
}
}
FREELISTPTR(provides);
alpm_list_free(provides);
} else if(can_remove_package(db, deppkg, newtargs)) {
pmpkg_t *pkg = _alpm_pkg_dup(deppkg);
@ -582,7 +581,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
_alpm_log(PM_LOG_DEBUG, _("started resolving dependencies"));
targ = alpm_list_add(NULL, syncpkg);
deps = _alpm_checkdeps(trans, local, PM_TRANS_TYPE_ADD, targ);
FREELISTPTR(targ);
alpm_list_free(targ);
if(deps == NULL) {
return(0);
@ -621,7 +620,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
if(provides) {
sync = provides->data;
}
FREELISTPTR(provides);
alpm_list_free(provides);
}
}

View File

@ -146,7 +146,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
_alpm_log(PM_LOG_DEBUG, _("sorting by dependencies"));
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
/* free the old alltargs */
FREELISTPTR(trans->packages);
alpm_list_free(trans->packages);
trans->packages = lp;
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);

View File

@ -286,7 +286,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
}
_alpm_log(PM_LOG_DEBUG, _("found '%s' as a provision for '%s'"), p->data, targ);
spkg = _alpm_db_get_pkgfromcache(db, p->data);
FREELISTPTR(p);
alpm_list_free(p);
}
}
}
@ -309,7 +309,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
if(p) {
_alpm_log(PM_LOG_DEBUG, _("found '%s' as a provision for '%s'"), p->data, targ);
spkg = _alpm_db_get_pkgfromcache(db, p->data);
FREELISTPTR(p);
alpm_list_free(p);
}
}
}
@ -458,8 +458,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
}
}
}
FREELISTPTR(k);
FREELISTPTR(trans->packages);
alpm_list_free(k);
alpm_list_free(trans->packages);
trans->packages = l;
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL);
@ -476,7 +476,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
goto cleanup;
}
FREELISTPTR(trail);
alpm_list_free(trail);
}
/* We don't care about conflicts if we're just printing uris */
@ -654,7 +654,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_DONE, NULL, NULL);
}
FREELISTPTR(list);
alpm_list_free(list);
list = NULL;
/* XXX: this fails for cases where a requested package wants
* a dependency that conflicts with an older version of
@ -764,8 +765,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
#endif
cleanup:
FREELISTPTR(list);
FREELISTPTR(trail);
alpm_list_free(list);
alpm_list_free(trail);
FREELIST(asked);
return(ret);

View File

@ -330,7 +330,7 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg)
alpm_pkg_get_name(deppkg), alpm_pkg_get_version(deppkg));
}
}
FREELISTPTR(provides);
alpm_list_free(provides);
if(!found_provides) {
_alpm_log(PM_LOG_DEBUG, _("could not find dependency '%s'"), dep->name);