summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-04-28 09:54:25 +0200
committerDan McGee <dan@archlinux.org>2007-04-28 09:54:25 +0200
commita57b2f233f28c275b0b171cb291415351f9ec87d (patch)
tree2a3cd06f53fc4d4b917c1a2f98414e445fee72ae
parenta8b683d8e29510742f94c7ff558cda19d6644b68 (diff)
downloadpacman-a57b2f233f28c275b0b171cb291415351f9ec87d.tar.gz
pacman-a57b2f233f28c275b0b171cb291415351f9ec87d.tar.xz
Remove FREELISTPTR macro
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/add.c2
-rw-r--r--lib/libalpm/alpm_list.h5
-rw-r--r--lib/libalpm/cache.c3
-rw-r--r--lib/libalpm/deps.c11
-rw-r--r--lib/libalpm/remove.c2
-rw-r--r--lib/libalpm/sync.c17
-rw-r--r--lib/libalpm/trans.c2
7 files changed, 20 insertions, 22 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index ed9b622e..9c08db86 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -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);
diff --git a/lib/libalpm/alpm_list.h b/lib/libalpm/alpm_list.h
index 838bd775..5812907f 100644
--- a/lib/libalpm/alpm_list.h
+++ b/lib/libalpm/alpm_list.h
@@ -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 */
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 72825c00..55ca6f51 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -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;
}
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 3a55dae1..6f075bb8 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -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);
}
}
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 943d4604..ce7ef9e4 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -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);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index c0b01da0..603504e8 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -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);
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index e0162524..87b8c1b6 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -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);