diff options
author | Dan McGee <dan@archlinux.org> | 2007-04-27 02:11:30 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-04-27 20:53:01 +0200 |
commit | ec7d6955b821c51a28efce31268c9c23cb1b5928 (patch) | |
tree | 2845c5169b4bb0303137e31fa18ae9ac8fbc7404 /lib | |
parent | db9e10f14215ab6453cd663a62cae5bdfac3d61b (diff) | |
download | pacman-ec7d6955b821c51a28efce31268c9c23cb1b5928.tar.gz pacman-ec7d6955b821c51a28efce31268c9c23cb1b5928.tar.xz |
Remove FREESYNC macro and correctly type _alpm_sync_free
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/alpm.c | 7 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 11 | ||||
-rw-r--r-- | lib/libalpm/sync.h | 4 | ||||
-rw-r--r-- | lib/libalpm/trans.c | 3 |
4 files changed, 14 insertions, 11 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 1b7eea59..63b418c1 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -1203,7 +1203,12 @@ alpm_list_t SYMEXPORT *alpm_get_upgrades() return(syncpkgs); error: if(syncpkgs) { - alpm_list_free_inner(syncpkgs, _alpm_sync_free); + alpm_list_t *tmp; + for(tmp = syncpkgs; tmp; tmp = alpm_list_next(tmp)) { + if(tmp->data) { + _alpm_sync_free(tmp->data); + } + } alpm_list_free(syncpkgs); } return(NULL); diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index de235d71..73c61873 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -74,10 +74,8 @@ pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data) return(sync); } -void _alpm_sync_free(void *data) +void _alpm_sync_free(pmsyncpkg_t *sync) { - pmsyncpkg_t *sync = data; - ALPM_LOG_FUNC; if(sync == NULL) { @@ -90,6 +88,7 @@ void _alpm_sync_free(void *data) FREEPKG(sync->data); } FREE(sync); + sync = NULL; } /* Find recommended replacements for packages during a sync. @@ -433,7 +432,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync sync = _alpm_sync_find(trans->packages, pkgname); trans->packages = alpm_list_remove(trans->packages, sync, syncpkg_cmp, &vpkg); - FREESYNC(vpkg); + _alpm_sync_free(vpkg); } } } @@ -565,7 +564,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync void *vpkg; _alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), rsync->pkg->name); trans->packages = alpm_list_remove(trans->packages, rsync, syncpkg_cmp, &vpkg); - FREESYNC(vpkg); + _alpm_sync_free(vpkg); continue; } } @@ -602,7 +601,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync void *vpkg; _alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), miss->depend.name); trans->packages = alpm_list_remove(trans->packages, rsync, syncpkg_cmp, &vpkg); - FREESYNC(vpkg); + _alpm_sync_free(vpkg); } } else { /* abort */ diff --git a/lib/libalpm/sync.h b/lib/libalpm/sync.h index 3ba7e009..ef094b5c 100644 --- a/lib/libalpm/sync.h +++ b/lib/libalpm/sync.h @@ -32,10 +32,8 @@ struct __pmsyncpkg_t { void *data; }; -#define FREESYNC(p) do { if(p) { _alpm_sync_free(p); p = NULL; } } while(0) - pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data); -void _alpm_sync_free(void *data); +void _alpm_sync_free(pmsyncpkg_t *data); int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync); int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, char *name); diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 27e22bc6..a101be4c 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -81,7 +81,7 @@ void _alpm_trans_free(pmtrans_t *trans) if(trans->type == PM_TRANS_TYPE_SYNC) { alpm_list_t *i; for(i = trans->packages; i; i = i->next) { - FREESYNC(i->data); + _alpm_sync_free(i->data); } FREELIST(trans->packages); } else { @@ -92,6 +92,7 @@ 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, |