1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

- started to rename list_XXX calls to _alpm_list_XXX

- fixed 2 compilation warnings
This commit is contained in:
Aurelien Foret 2006-01-05 21:49:42 +00:00
parent ef8bbd2ac4
commit 5fc2e009dc
7 changed files with 19 additions and 44 deletions

View File

@ -495,7 +495,6 @@ PMList* removedeps(pmdb_t *db, PMList *targs)
{ {
PMList *i, *j, *k; PMList *i, *j, *k;
PMList *newtargs = targs; PMList *newtargs = targs;
char realpkgname[255];
if(db == NULL) { if(db == NULL) {
return(newtargs); return(newtargs);

View File

@ -27,32 +27,7 @@
/* pacman */ /* pacman */
#include "list.h" #include "list.h"
/* Check PMList sanity PMList* _alpm_list_new()
*
* 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 *list = NULL; PMList *list = NULL;
@ -67,7 +42,7 @@ PMList* pm_list_new()
return(list); return(list);
} }
void pm_list_free(PMList *list) void _alpm_list_free(PMList *list)
{ {
PMList *ptr, *it = list; PMList *ptr, *it = list;
@ -85,17 +60,17 @@ PMList* pm_list_add(PMList *list, void *data)
ptr = list; ptr = list;
if(ptr == NULL) { if(ptr == NULL) {
ptr = pm_list_new(); ptr = _alpm_list_new();
if(ptr == NULL) { if(ptr == NULL) {
return(NULL); return(NULL);
} }
} }
lp = pm_list_last(ptr); lp = _alpm_list_last(ptr);
if(lp == ptr && lp->data == NULL) { if(lp == ptr && lp->data == NULL) {
/* nada */ /* nada */
} else { } else {
lp->next = pm_list_new(); lp->next = _alpm_list_new();
if(lp->next == NULL) { if(lp->next == NULL) {
return(NULL); return(NULL);
} }
@ -119,7 +94,7 @@ PMList* pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn)
PMList *prev = NULL; PMList *prev = NULL;
PMList *iter = list; PMList *iter = list;
add = pm_list_new(); add = _alpm_list_new();
add->data = data; add->data = data;
/* Find insertion point. */ /* Find insertion point. */
@ -209,7 +184,7 @@ PMList *_alpm_list_remove(PMList *haystack, void *needle, pm_fn_cmp fn, void **d
return(haystack); return(haystack);
} }
int pm_list_count(PMList *list) int _alpm_list_count(PMList *list)
{ {
int i; int i;
PMList *lp; PMList *lp;
@ -245,7 +220,7 @@ PMList *pm_list_is_strin(char *needle, PMList *haystack)
return(NULL); return(NULL);
} }
PMList* pm_list_last(PMList *list) PMList *_alpm_list_last(PMList *list)
{ {
if(list == NULL) { if(list == NULL) {
return(NULL); return(NULL);

View File

@ -31,7 +31,7 @@ typedef struct __pmlist_t {
typedef struct __pmlist_t PMList; 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 { \ #define FREELISTPTR(p) do { \
PMList *i; \ PMList *i; \
for(i = p; i; i = i->next) { \ for(i = p; i; i = i->next) { \
@ -43,15 +43,15 @@ typedef struct __pmlist_t PMList;
/* Sort comparison callback function declaration */ /* Sort comparison callback function declaration */
typedef int (*pm_fn_cmp) (const void *, const void *); typedef int (*pm_fn_cmp) (const void *, const void *);
PMList *pm_list_new(void); PMList *_alpm_list_new(void);
void pm_list_free(PMList *list); void _alpm_list_free(PMList *list);
PMList *pm_list_add(PMList *list, void *data); PMList *pm_list_add(PMList *list, void *data);
PMList *pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn); 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); 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); int pm_list_is_in(void *needle, PMList *haystack);
PMList *pm_list_is_strin(char *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_remove_dupes(PMList *list);
PMList *_alpm_list_reverse(PMList *list); PMList *_alpm_list_reverse(PMList *list);
PMList *_alpm_list_strdup(PMList *list); PMList *_alpm_list_strdup(PMList *list);

View File

@ -164,7 +164,7 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
_alpm_log(PM_LOG_FLOW1, "removing files"); _alpm_log(PM_LOG_FLOW1, "removing files");
/* iterate through the list backwards, unlinking 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; int nb = 0;
char *file = lp->data; char *file = lp->data;
char *md5 =_alpm_needbackup(lp->data, info->backup); char *md5 =_alpm_needbackup(lp->data, info->backup);

View File

@ -354,7 +354,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
pmsyncpkg_t *sync = i->data; pmsyncpkg_t *sync = i->data;
list = pm_list_add(list, sync->pkg); list = pm_list_add(list, sync->pkg);
} }
trail = pm_list_new(); trail = _alpm_list_new();
/* Resolve targets dependencies */ /* Resolve targets dependencies */
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL); 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) { if(trans_addtarget(tr, str) == -1) {
goto error; 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 */ * 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) { if(sync->type == PM_SYNC_TYPE_DEPEND) {
/* ORE /* ORE
* if called from makepkg, reason should be set to PM_PKG_REASON_DEPEND */ * if called from makepkg, reason should be set to PM_PKG_REASON_DEPEND */

View File

@ -20,6 +20,7 @@
*/ */
#include "config.h" #include "config.h"
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>

View File

@ -134,7 +134,7 @@ int main(int argc, char* argv[])
snprintf(line, PATH_MAX, "/bin/cp %s %s/install", path, topdir); snprintf(line, PATH_MAX, "/bin/cp %s %s/install", path, topdir);
system(line); system(line);
} }
pm_list_free(backup); _alpm_list_free(backup);
} }
umask(oldumask); umask(oldumask);
return(0); return(0);