summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-04-27 02:15:51 +0200
committerDan McGee <dan@archlinux.org>2007-04-28 02:38:54 +0200
commit3cf8a333d04cd8b55edfe63bd8f4dd322a88a4d0 (patch)
tree4687343834084a984dcf2490699428310b21333f /lib/libalpm
parentec7d6955b821c51a28efce31268c9c23cb1b5928 (diff)
downloadpacman-3cf8a333d04cd8b55edfe63bd8f4dd322a88a4d0.tar.gz
pacman-3cf8a333d04cd8b55edfe63bd8f4dd322a88a4d0.tar.xz
Remove FREEGRP macro and correctly type _alpm_grp_free
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/cache.c3
-rw-r--r--lib/libalpm/group.c6
-rw-r--r--lib/libalpm/group.h5
-rw-r--r--lib/libalpm/sync.c2
-rw-r--r--lib/libalpm/trans.c4
5 files changed, 7 insertions, 13 deletions
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 5f9b5fd0..632a9bbd 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -251,7 +251,8 @@ void _alpm_db_free_grpcache(pmdb_t *db)
pmgrp_t *grp = lg->data;
FREELISTPTR(grp->packages);
- FREEGRP(lg->data);
+ _alpm_grp_free(lg->data);
+ lg->data = NULL;
}
FREELIST(db->grpcache);
}
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index cd68cb17..bd2280eb 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -49,10 +49,8 @@ pmgrp_t *_alpm_grp_new()
return(grp);
}
-void _alpm_grp_free(void *data)
+void _alpm_grp_free(pmgrp_t *grp)
{
- pmgrp_t *grp = data;
-
ALPM_LOG_FUNC;
if(grp == NULL) {
@@ -61,8 +59,6 @@ void _alpm_grp_free(void *data)
FREELIST(grp->packages);
FREE(grp);
-
- return;
}
/* Helper function for sorting groups
diff --git a/lib/libalpm/group.h b/lib/libalpm/group.h
index c5366e64..7f679b55 100644
--- a/lib/libalpm/group.h
+++ b/lib/libalpm/group.h
@@ -31,11 +31,8 @@ struct __pmgrp_t {
alpm_list_t *packages; /* List of strings */
};
-#define FREEGRP(p) do { if(p) { _alpm_grp_free(p); p = NULL; } } while(0)
-#define FREELISTGRPS(p) _FREELIST(p, _alpm_grp_free)
-
pmgrp_t *_alpm_grp_new(void);
-void _alpm_grp_free(void *data);
+void _alpm_grp_free(pmgrp_t *grp);
int _alpm_grp_cmp(const void *g1, const void *g2);
#endif /* _ALPM_GROUP_H */
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 73c61873..10d1eb61 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -82,13 +82,13 @@ void _alpm_sync_free(pmsyncpkg_t *sync)
return;
}
+ /* TODO wow this is ugly */
if(sync->type == PM_SYNC_TYPE_REPLACE) {
FREELISTPKGS(sync->data);
} else {
FREEPKG(sync->data);
}
FREE(sync);
- sync = NULL;
}
/* Find recommended replacements for packages during a sync.
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index a101be4c..54267bfc 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -80,8 +80,9 @@ void _alpm_trans_free(pmtrans_t *trans)
FREELIST(trans->targets);
if(trans->type == PM_TRANS_TYPE_SYNC) {
alpm_list_t *i;
- for(i = trans->packages; i; i = i->next) {
+ for(i = trans->packages; i; i = alpm_list_next(i)) {
_alpm_sync_free(i->data);
+ i->data = NULL;
}
FREELIST(trans->packages);
} else {
@@ -92,7 +93,6 @@ void _alpm_trans_free(pmtrans_t *trans)
FREELIST(trans->skip_remove);
FREE(trans);
- trans = NULL;
}
int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, pmtransflag_t flags,