diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2006-01-05 21:49:42 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2006-01-05 21:49:42 +0000 |
commit | 5fc2e009dccc2075ee87210cd1cb3fda57fbc5d6 (patch) | |
tree | e8476e7c02466147e37872b7a109fb7ae7c39c1e /lib | |
parent | ef8bbd2ac496604df949e0bce978a3c53dbaede3 (diff) |
- started to rename list_XXX calls to _alpm_list_XXX
- fixed 2 compilation warnings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/deps.c | 1 | ||||
-rw-r--r-- | lib/libalpm/list.c | 41 | ||||
-rw-r--r-- | lib/libalpm/list.h | 10 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 2 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 6 | ||||
-rw-r--r-- | lib/libalpm/versioncmp.c | 1 |
6 files changed, 18 insertions, 43 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 4d0dd602..7d0d91eb 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -495,7 +495,6 @@ PMList* removedeps(pmdb_t *db, PMList *targs) { PMList *i, *j, *k; PMList *newtargs = targs; - char realpkgname[255]; if(db == NULL) { return(newtargs); diff --git a/lib/libalpm/list.c b/lib/libalpm/list.c index e253d1cc..f06102f5 100644 --- a/lib/libalpm/list.c +++ b/lib/libalpm/list.c @@ -27,32 +27,7 @@ /* pacman */ #include "list.h" -/* Check PMList sanity - * - * 1: List seems to be OK. - * 0: We're in deep ... - */ -int _alpm_list_check(PMList* list) -{ - PMList* it = NULL; - - if(list == NULL) { - return(1); - } - if(list->last == NULL) { - return(0); - } - - for(it = list; it && it->next; it = it->next); - - if(it != list->last) { - return(0); - } - - return(1); -} - -PMList* pm_list_new() +PMList* _alpm_list_new() { PMList *list = NULL; @@ -67,7 +42,7 @@ PMList* pm_list_new() return(list); } -void pm_list_free(PMList *list) +void _alpm_list_free(PMList *list) { PMList *ptr, *it = list; @@ -85,17 +60,17 @@ PMList* pm_list_add(PMList *list, void *data) ptr = list; if(ptr == NULL) { - ptr = pm_list_new(); + ptr = _alpm_list_new(); if(ptr == NULL) { return(NULL); } } - lp = pm_list_last(ptr); + lp = _alpm_list_last(ptr); if(lp == ptr && lp->data == NULL) { /* nada */ } else { - lp->next = pm_list_new(); + lp->next = _alpm_list_new(); if(lp->next == NULL) { return(NULL); } @@ -119,7 +94,7 @@ PMList* pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn) PMList *prev = NULL; PMList *iter = list; - add = pm_list_new(); + add = _alpm_list_new(); add->data = data; /* Find insertion point. */ @@ -209,7 +184,7 @@ PMList *_alpm_list_remove(PMList *haystack, void *needle, pm_fn_cmp fn, void **d return(haystack); } -int pm_list_count(PMList *list) +int _alpm_list_count(PMList *list) { int i; PMList *lp; @@ -245,7 +220,7 @@ PMList *pm_list_is_strin(char *needle, PMList *haystack) return(NULL); } -PMList* pm_list_last(PMList *list) +PMList *_alpm_list_last(PMList *list) { if(list == NULL) { return(NULL); diff --git a/lib/libalpm/list.h b/lib/libalpm/list.h index d1cdb385..706e61b8 100644 --- a/lib/libalpm/list.h +++ b/lib/libalpm/list.h @@ -31,7 +31,7 @@ typedef struct __pmlist_t { typedef struct __pmlist_t PMList; -#define FREELIST(p) do { if(p) { pm_list_free(p); p = NULL; } } while(0) +#define FREELIST(p) do { if(p) { _alpm_list_free(p); p = NULL; } } while(0) #define FREELISTPTR(p) do { \ PMList *i; \ for(i = p; i; i = i->next) { \ @@ -43,15 +43,15 @@ typedef struct __pmlist_t PMList; /* Sort comparison callback function declaration */ typedef int (*pm_fn_cmp) (const void *, const void *); -PMList *pm_list_new(void); -void pm_list_free(PMList *list); +PMList *_alpm_list_new(void); +void _alpm_list_free(PMList *list); PMList *pm_list_add(PMList *list, void *data); PMList *pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn); PMList *_alpm_list_remove(PMList *haystack, void *needle, pm_fn_cmp fn, void **data); -int pm_list_count(PMList *list); +int _alpm_list_count(PMList *list); int pm_list_is_in(void *needle, PMList *haystack); PMList *pm_list_is_strin(char *needle, PMList *haystack); -PMList *pm_list_last(PMList *list); +PMList *_alpm_list_last(PMList *list); PMList *_alpm_list_remove_dupes(PMList *list); PMList *_alpm_list_reverse(PMList *list); PMList *_alpm_list_strdup(PMList *list); diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 7462fa2d..7356870b 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -164,7 +164,7 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db) _alpm_log(PM_LOG_FLOW1, "removing files"); /* iterate through the list backwards, unlinking files */ - for(lp = pm_list_last(info->files); lp; lp = lp->prev) { + for(lp = _alpm_list_last(info->files); lp; lp = lp->prev) { int nb = 0; char *file = lp->data; char *md5 =_alpm_needbackup(lp->data, info->backup); diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 25ac6dff..3eadfdf1 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -354,7 +354,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList ** pmsyncpkg_t *sync = i->data; list = pm_list_add(list, sync->pkg); } - trail = pm_list_new(); + trail = _alpm_list_new(); /* Resolve targets dependencies */ EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL); @@ -660,9 +660,9 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local) if(trans_addtarget(tr, str) == -1) { goto error; } - /* using list_last() is ok because addtarget() adds the new target at the + /* using _alpm_list_last() is ok because addtarget() adds the new target at the * end of the tr->packages list */ - spkg = pm_list_last(tr->packages)->data; + spkg = _alpm_list_last(tr->packages)->data; if(sync->type == PM_SYNC_TYPE_DEPEND) { /* ORE * if called from makepkg, reason should be set to PM_PKG_REASON_DEPEND */ diff --git a/lib/libalpm/versioncmp.c b/lib/libalpm/versioncmp.c index 36ce8f2a..a7dae40b 100644 --- a/lib/libalpm/versioncmp.c +++ b/lib/libalpm/versioncmp.c @@ -20,6 +20,7 @@ */ #include "config.h" +#include <stdlib.h> #include <stdio.h> #include <ctype.h> #include <string.h> |