Remove FREEGRP macro and correctly type _alpm_grp_free

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-04-26 20:15:51 -04:00
parent ec7d6955b8
commit 3cf8a333d0
5 changed files with 7 additions and 13 deletions

View file

@ -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);
}

View file

@ -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

View file

@ -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 */

View file

@ -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.

View file

@ -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,