From 69bc2e62fe2b94bb1189959e4ed396ffbf5088e1 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 26 Apr 2007 20:23:03 -0400 Subject: [PATCH] Remove FREESERVER macro and correctly type _alpm_server_free Signed-off-by: Dan McGee --- lib/libalpm/alpm_list.c | 2 +- lib/libalpm/db.c | 5 ++++- lib/libalpm/server.c | 4 +--- lib/libalpm/server.h | 4 +--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c index 0f05df8a..4977f1ac 100644 --- a/lib/libalpm/alpm_list.c +++ b/lib/libalpm/alpm_list.c @@ -404,7 +404,7 @@ alpm_list_t *alpm_list_reverse(alpm_list_t *list) * * @return the first element in the list */ -alpm_list_t SYMEXPORT *alpm_list_first(alpm_list_t *list) +inline alpm_list_t SYMEXPORT *alpm_list_first(alpm_list_t *list) { return(list); } diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 183f71d3..eef27b7e 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -83,7 +83,10 @@ void _alpm_db_free(pmdb_t *db) { ALPM_LOG_FUNC; - _FREELIST(db->servers, _alpm_server_free); + alpm_list_t *tmp; + for(tmp = db->servers; tmp; tmp = alpm_list_next(tmp)) { + _alpm_server_free(tmp->data); + } FREE(db->path); FREE(db); diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c index b9182a02..1b629a81 100644 --- a/lib/libalpm/server.c +++ b/lib/libalpm/server.c @@ -76,10 +76,8 @@ pmserver_t *_alpm_server_new(const char *url) return server; } -void _alpm_server_free(void *data) +void _alpm_server_free(pmserver_t *server) { - pmserver_t *server = data; - ALPM_LOG_FUNC; if(server == NULL) { diff --git a/lib/libalpm/server.h b/lib/libalpm/server.h index 8c357ab2..b560f831 100644 --- a/lib/libalpm/server.h +++ b/lib/libalpm/server.h @@ -27,8 +27,6 @@ #include #include -#define FREESERVER(p) do { if(p){_alpm_server_free(p); p = NULL;}} while(0) - /* Servers */ struct __pmserver_t { /* useless abstraction now? */ @@ -38,7 +36,7 @@ struct __pmserver_t { #define PM_DLBUF_LEN (1024 * 10) pmserver_t *_alpm_server_new(const char *url); -void _alpm_server_free(void *data); +void _alpm_server_free(pmserver_t *server); int _alpm_downloadfiles(alpm_list_t *servers, const char *localpath, alpm_list_t *files); int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath, alpm_list_t *files, const char *mtime1, char *mtime2);