1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Remove FREESYNC macro and correctly type _alpm_sync_free

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-04-26 20:11:30 -04:00
parent db9e10f142
commit ec7d6955b8
4 changed files with 14 additions and 11 deletions

View File

@ -1203,7 +1203,12 @@ alpm_list_t SYMEXPORT *alpm_get_upgrades()
return(syncpkgs); return(syncpkgs);
error: error:
if(syncpkgs) { 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); alpm_list_free(syncpkgs);
} }
return(NULL); return(NULL);

View File

@ -74,10 +74,8 @@ pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data)
return(sync); return(sync);
} }
void _alpm_sync_free(void *data) void _alpm_sync_free(pmsyncpkg_t *sync)
{ {
pmsyncpkg_t *sync = data;
ALPM_LOG_FUNC; ALPM_LOG_FUNC;
if(sync == NULL) { if(sync == NULL) {
@ -90,6 +88,7 @@ void _alpm_sync_free(void *data)
FREEPKG(sync->data); FREEPKG(sync->data);
} }
FREE(sync); FREE(sync);
sync = NULL;
} }
/* Find recommended replacements for packages during a sync. /* 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); sync = _alpm_sync_find(trans->packages, pkgname);
trans->packages = alpm_list_remove(trans->packages, sync, syncpkg_cmp, &vpkg); 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; void *vpkg;
_alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), rsync->pkg->name); _alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), rsync->pkg->name);
trans->packages = alpm_list_remove(trans->packages, rsync, syncpkg_cmp, &vpkg); trans->packages = alpm_list_remove(trans->packages, rsync, syncpkg_cmp, &vpkg);
FREESYNC(vpkg); _alpm_sync_free(vpkg);
continue; continue;
} }
} }
@ -602,7 +601,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
void *vpkg; void *vpkg;
_alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), miss->depend.name); _alpm_log(PM_LOG_DEBUG, _("removing '%s' from target list"), miss->depend.name);
trans->packages = alpm_list_remove(trans->packages, rsync, syncpkg_cmp, &vpkg); trans->packages = alpm_list_remove(trans->packages, rsync, syncpkg_cmp, &vpkg);
FREESYNC(vpkg); _alpm_sync_free(vpkg);
} }
} else { } else {
/* abort */ /* abort */

View File

@ -32,10 +32,8 @@ struct __pmsyncpkg_t {
void *data; 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); 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_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); int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, char *name);

View File

@ -81,7 +81,7 @@ void _alpm_trans_free(pmtrans_t *trans)
if(trans->type == PM_TRANS_TYPE_SYNC) { if(trans->type == PM_TRANS_TYPE_SYNC) {
alpm_list_t *i; alpm_list_t *i;
for(i = trans->packages; i; i = i->next) { for(i = trans->packages; i; i = i->next) {
FREESYNC(i->data); _alpm_sync_free(i->data);
} }
FREELIST(trans->packages); FREELIST(trans->packages);
} else { } else {
@ -92,6 +92,7 @@ void _alpm_trans_free(pmtrans_t *trans)
FREELIST(trans->skip_remove); FREELIST(trans->skip_remove);
FREE(trans); FREE(trans);
trans = NULL;
} }
int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, pmtransflag_t flags, int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, pmtransflag_t flags,