From 65fb99133df10143e07c237f04777e01b443c037 Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Sun, 18 Nov 2007 10:29:55 +0100 Subject: Simple s/conflict/fileconflict/ renaming. The names related to conflicts are misleading : For dependencies conflicts, the type is pmdepmissing, and the function names contain just "conflict". For file conflicts, the type is pmconflict, and some functions contained just "conflict", some others "fileconflict". So this is the first step for improving the situation. Original idea/patch from Nagy, but the patch already didn't apply anymore, so I did it again. The main difference is that I kept the conflictype, with the following renaming : pmconflicttype_t -> pmfileconflicttype_t PM_CONFLICT_TYPE_TARGET -> PM_FILECONFLICT_TARGET PM_CONFLICT_TYPE_FILE -> PM_FILECONFLICT_FILESYSTEM Signed-off-by: Chantry Xavier --- lib/libalpm/add.c | 2 +- lib/libalpm/alpm.h | 18 +++++++++--------- lib/libalpm/conflict.c | 24 ++++++++++++------------ lib/libalpm/conflict.h | 6 +++--- lib/libalpm/remove.c | 2 +- src/pacman/add.c | 18 +++++++++--------- src/pacman/sync.c | 18 +++++++++--------- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index f6bab199..fbdf4ea4 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -221,7 +221,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL); _alpm_log(PM_LOG_DEBUG, "looking for file conflicts\n"); - lp = _alpm_db_find_conflicts(db, trans, handle->root); + lp = _alpm_db_find_fileconflicts(db, trans, handle->root); if(lp != NULL) { if(data) { *data = lp; diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index e8726bcc..a28c912a 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -52,7 +52,7 @@ typedef struct __pmtrans_t pmtrans_t; typedef struct __pmsyncpkg_t pmsyncpkg_t; typedef struct __pmdepend_t pmdepend_t; typedef struct __pmdepmissing_t pmdepmissing_t; -typedef struct __pmconflict_t pmconflict_t; +typedef struct __pmfileconflict_t pmfileconflict_t; typedef struct __pmgraph_t pmgraph_t; /* @@ -390,15 +390,15 @@ char *alpm_dep_get_string(const pmdepend_t *dep); * File conflicts */ -typedef enum _pmconflicttype_t { - PM_CONFLICT_TYPE_TARGET = 1, - PM_CONFLICT_TYPE_FILE -} pmconflicttype_t; +typedef enum _pmfileconflicttype_t { + PM_FILECONFLICT_TARGET = 1, + PM_FILECONFLICT_FILESYSTEM +} pmfileconflicttype_t; -const char *alpm_conflict_get_target(pmconflict_t *conflict); -pmconflicttype_t alpm_conflict_get_type(pmconflict_t *conflict); -const char *alpm_conflict_get_file(pmconflict_t *conflict); -const char *alpm_conflict_get_ctarget(pmconflict_t *conflict); +const char *alpm_fileconflict_get_target(pmfileconflict_t *conflict); +pmfileconflicttype_t alpm_fileconflict_get_type(pmfileconflict_t *conflict); +const char *alpm_fileconflict_get_file(pmfileconflict_t *conflict); +const char *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict); /* * Helpers diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 91fd794d..d72dd97a 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -230,17 +230,17 @@ static alpm_list_t *chk_filedifference(alpm_list_t *filesA, alpm_list_t *filesB) return(ret); } -/* Adds pmconflict_t to a conflicts list. Pass the conflicts list, type (either - * PM_CONFLICT_TYPE_TARGET or PM_CONFLICT_TYPE_FILE), a file string, and either +/* Adds pmfileconflict_t to a conflicts list. Pass the conflicts list, type (either + * PM_FILECONFLICT_TARGET or PM_FILECONFLICT_FILESYSTEM), a file string, and either * two package names or one package name and NULL. This is a wrapper for former * functionality that was done inline. */ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts, - pmconflicttype_t type, const char *filestr, + pmfileconflicttype_t type, const char *filestr, const char* name1, const char* name2) { - pmconflict_t *conflict; - MALLOC(conflict, sizeof(pmconflict_t), return(conflicts)); + pmfileconflict_t *conflict; + MALLOC(conflict, sizeof(pmfileconflict_t), return(conflicts)); conflict->type = type; strncpy(conflict->target, name1, PKG_NAME_LEN); @@ -261,7 +261,7 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts, /* Find file conflicts that may occur during the transaction with two checks: * 1: check every target against every target * 2: check every target against the filesystem */ -alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root) +alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *root) { alpm_list_t *i, *conflicts = NULL; alpm_list_t *targets = trans->packages; @@ -304,7 +304,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root) if(tmpfiles) { for(k = tmpfiles; k; k = k->next) { snprintf(path, PATH_MAX, "%s%s", root, (char *)k->data); - conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_TARGET, path, + conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_TARGET, path, alpm_pkg_get_name(p1), alpm_pkg_get_name(p2)); } FREELIST(tmpfiles); @@ -407,7 +407,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root) } if(!resolved_conflict) { _alpm_log(PM_LOG_DEBUG, "file found in conflict: %s\n", path); - conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_FILE, + conflicts = add_fileconflict(conflicts, PM_FILECONFLICT_FILESYSTEM, path, p1->name, NULL); } } @@ -418,7 +418,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root) return(conflicts); } -const char SYMEXPORT *alpm_conflict_get_target(pmconflict_t *conflict) +const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict) { ALPM_LOG_FUNC; @@ -429,7 +429,7 @@ const char SYMEXPORT *alpm_conflict_get_target(pmconflict_t *conflict) return conflict->target; } -pmconflicttype_t SYMEXPORT alpm_conflict_get_type(pmconflict_t *conflict) +pmfileconflicttype_t SYMEXPORT alpm_fileconflict_get_type(pmfileconflict_t *conflict) { ALPM_LOG_FUNC; @@ -440,7 +440,7 @@ pmconflicttype_t SYMEXPORT alpm_conflict_get_type(pmconflict_t *conflict) return conflict->type; } -const char SYMEXPORT *alpm_conflict_get_file(pmconflict_t *conflict) +const char SYMEXPORT *alpm_fileconflict_get_file(pmfileconflict_t *conflict) { ALPM_LOG_FUNC; @@ -451,7 +451,7 @@ const char SYMEXPORT *alpm_conflict_get_file(pmconflict_t *conflict) return conflict->file; } -const char SYMEXPORT *alpm_conflict_get_ctarget(pmconflict_t *conflict) +const char SYMEXPORT *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict) { ALPM_LOG_FUNC; diff --git a/lib/libalpm/conflict.h b/lib/libalpm/conflict.h index c4f1d600..f8aebbf1 100644 --- a/lib/libalpm/conflict.h +++ b/lib/libalpm/conflict.h @@ -27,15 +27,15 @@ #define CONFLICT_FILE_LEN 512 -struct __pmconflict_t { +struct __pmfileconflict_t { char target[PKG_NAME_LEN]; - pmconflicttype_t type; + pmfileconflicttype_t type; char file[CONFLICT_FILE_LEN]; char ctarget[PKG_NAME_LEN]; }; alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages); -alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root); +alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans, char *root); #endif /* _ALPM_CONFLICT_H */ diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 018216fe..592cf39e 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -219,7 +219,7 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, pmtrans_t *trans) } } else { /* check the remove skip list before removing the file. - * see the big comment block in db_find_conflicts() for an + * see the big comment block in db_find_fileconflicts() for an * explanation. */ if(alpm_list_find_str(trans->skip_remove, file)) { _alpm_log(PM_LOG_DEBUG, "%s is in trans->skip_remove, skipping removal\n", diff --git a/src/pacman/add.c b/src/pacman/add.c index c2236438..f685cc70 100644 --- a/src/pacman/add.c +++ b/src/pacman/add.c @@ -155,18 +155,18 @@ int pacman_add(alpm_list_t *targets) break; case PM_ERR_FILE_CONFLICTS: for(i = data; i; i = alpm_list_next(i)) { - pmconflict_t *conflict = alpm_list_getdata(i); - switch(alpm_conflict_get_type(conflict)) { - case PM_CONFLICT_TYPE_TARGET: + pmfileconflict_t *conflict = alpm_list_getdata(i); + switch(alpm_fileconflict_get_type(conflict)) { + case PM_FILECONFLICT_TARGET: printf(_("%s exists in both '%s' and '%s'\n"), - alpm_conflict_get_file(conflict), - alpm_conflict_get_target(conflict), - alpm_conflict_get_ctarget(conflict)); + alpm_fileconflict_get_file(conflict), + alpm_fileconflict_get_target(conflict), + alpm_fileconflict_get_ctarget(conflict)); break; - case PM_CONFLICT_TYPE_FILE: + case PM_FILECONFLICT_FILESYSTEM: printf(_("%s: %s exists in filesystem\n"), - alpm_conflict_get_target(conflict), - alpm_conflict_get_file(conflict)); + alpm_fileconflict_get_target(conflict), + alpm_fileconflict_get_file(conflict)); break; } } diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 10a61613..2d30e641 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -674,18 +674,18 @@ int sync_trans(alpm_list_t *targets, int sync_only) alpm_list_t *i; case PM_ERR_FILE_CONFLICTS: for(i = data; i; i = alpm_list_next(i)) { - pmconflict_t *conflict = alpm_list_getdata(i); - switch(alpm_conflict_get_type(conflict)) { - case PM_CONFLICT_TYPE_TARGET: + pmfileconflict_t *conflict = alpm_list_getdata(i); + switch(alpm_fileconflict_get_type(conflict)) { + case PM_FILECONFLICT_TARGET: printf(_("%s exists in both '%s' and '%s'\n"), - alpm_conflict_get_file(conflict), - alpm_conflict_get_target(conflict), - alpm_conflict_get_ctarget(conflict)); + alpm_fileconflict_get_file(conflict), + alpm_fileconflict_get_target(conflict), + alpm_fileconflict_get_ctarget(conflict)); break; - case PM_CONFLICT_TYPE_FILE: + case PM_FILECONFLICT_FILESYSTEM: printf(_("%s: %s exists in filesystem\n"), - alpm_conflict_get_target(conflict), - alpm_conflict_get_file(conflict)); + alpm_fileconflict_get_target(conflict), + alpm_fileconflict_get_file(conflict)); break; } } -- cgit v1.2.3-70-g09d2