diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2005-04-24 21:36:30 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-04-24 21:36:30 +0000 |
commit | beda47fd22d204ba7f79ccab5251ed13c3faf82d (patch) | |
tree | f583cd91f88526561eda7373bc0a8b1e7cb02349 | |
parent | a9540e2c7629bd7ecd7e98a562f77e33a289dba9 (diff) |
code cleanup
-rw-r--r-- | lib/libalpm/group.c | 2 | ||||
-rw-r--r-- | lib/libalpm/package.h | 15 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 16 |
3 files changed, 21 insertions, 12 deletions
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c index 295be2f3..0c6930ec 100644 --- a/lib/libalpm/group.c +++ b/lib/libalpm/group.c @@ -49,7 +49,7 @@ void grp_free(pmgrp_t *grp) } FREELIST(grp->packages); - FREE(grp); + free(grp); return; } diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index 105a80aa..a555a7e9 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -67,12 +67,19 @@ typedef struct __pmpkg_t { unsigned char infolevel; } pmpkg_t; -#define FREEPKG(p) do { if(p) { pkg_free(p); p = NULL; } } while(0) +#define FREEPKG(p) \ +do { \ + if(p) { \ + pkg_free(p); \ + p = NULL; \ + } \ +} while(0) -#define FREELISTPKGS(p) do {\ +#define FREELISTPKGS(p) \ +do { \ if(p) { \ - PMList *i;\ - for(i = p; i; i = i->next) {\ + PMList *i; \ + for(i = p; i; i = i->next) { \ FREEPKG(i->data); \ }\ FREELIST(p);\ diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 8d6ee1d0..113fec9d 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -63,14 +63,16 @@ pmsyncpkg_t *sync_new(int type, pmpkg_t *spkg, void *data) void sync_free(pmsyncpkg_t *sync) { - if(sync) { - if(sync->type == PM_SYNC_TYPE_REPLACE) { - FREELISTPKGS(sync->data); - } else { - FREEPKG(sync->data); - } - free(sync); + if(sync == NULL) { + return; + } + + if(sync->type == PM_SYNC_TYPE_REPLACE) { + FREELISTPKGS(sync->data); + } else { + FREEPKG(sync->data); } + free(sync); } /* Test for existance of a package in a PMList* of pmsyncpkg_t* |