From bdf00d3dbd19c3def6127f3d372d630930a26abb Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Jun 2011 11:27:44 -0500 Subject: Make pmfileconflict_t type public This removes the need to write accessor methods for every type we have, and simplifies the API. Any type that doesn't need magic* can be converted in this fashion to make it easier for frontend applications to use, as well as make it less of a pain to introduce new such structs in the future. * "magic" meaning something like pmpkg_t where values can be lazy loaded. Signed-off-by: Dan McGee --- src/pacman/upgrade.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/pacman/upgrade.c') diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c index c0466456..37cf7007 100644 --- a/src/pacman/upgrade.c +++ b/src/pacman/upgrade.c @@ -173,17 +173,14 @@ int pacman_upgrade(alpm_list_t *targets) case PM_ERR_FILE_CONFLICTS: for(i = data; i; i = alpm_list_next(i)) { pmfileconflict_t *conflict = alpm_list_getdata(i); - switch(alpm_fileconflict_get_type(conflict)) { + switch(conflict->type) { case PM_FILECONFLICT_TARGET: printf(_("%s exists in both '%s' and '%s'\n"), - alpm_fileconflict_get_file(conflict), - alpm_fileconflict_get_target(conflict), - alpm_fileconflict_get_ctarget(conflict)); + conflict->file, conflict->target, conflict->ctarget); break; case PM_FILECONFLICT_FILESYSTEM: printf(_("%s: %s exists in filesystem\n"), - alpm_fileconflict_get_target(conflict), - alpm_fileconflict_get_file(conflict)); + conflict->target, conflict->file); break; } } -- cgit v1.2.3 From 19fcc7401666cd892f7b8a5a49854a1b2eb9988b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Jun 2011 11:33:20 -0500 Subject: Make struct pmconflict_t public Signed-off-by: Dan McGee --- src/pacman/upgrade.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/pacman/upgrade.c') diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c index 37cf7007..0abcbe4e 100644 --- a/src/pacman/upgrade.c +++ b/src/pacman/upgrade.c @@ -121,14 +121,13 @@ int pacman_upgrade(alpm_list_t *targets) case PM_ERR_CONFLICTING_DEPS: for(i = data; i; i = alpm_list_next(i)) { pmconflict_t *conflict = alpm_list_getdata(i); - const char *package1 = alpm_conflict_get_package1(conflict); - const char *package2 = alpm_conflict_get_package2(conflict); - const char *reason = alpm_conflict_get_reason(conflict); - /* only print reason if it contains new information */ - if(strcmp(package1, reason) == 0 || strcmp(package2, reason) == 0) { - printf(_(":: %s and %s are in conflict\n"), package1, package2); + if(strcmp(conflict->package1, conflict->reason) == 0 || + strcmp(conflict->package2, conflict->reason) == 0) { + printf(_(":: %s and %s are in conflict\n"), + conflict->package1, conflict->package2); } else { - printf(_(":: %s and %s are in conflict (%s)\n"), package1, package2, reason); + printf(_(":: %s and %s are in conflict (%s)\n"), + conflict->package1, conflict->package2, conflict->reason); } } break; -- cgit v1.2.3 From 7f6c1a76c66fb718fad2ecce68f99ee13d18ff15 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Jun 2011 11:42:10 -0500 Subject: Make pmdepend_t and pmdepmissing_t public Signed-off-by: Dan McGee --- src/pacman/upgrade.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/pacman/upgrade.c') diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c index 0abcbe4e..6587671b 100644 --- a/src/pacman/upgrade.c +++ b/src/pacman/upgrade.c @@ -107,14 +107,12 @@ int pacman_upgrade(alpm_list_t *targets) case PM_ERR_UNSATISFIED_DEPS: for(i = data; i; i = alpm_list_next(i)) { pmdepmissing_t *miss = alpm_list_getdata(i); - pmdepend_t *dep = alpm_miss_get_dep(miss); - char *depstring = alpm_dep_compute_string(dep); + char *depstring = alpm_dep_compute_string(miss->depend); /* TODO indicate if the error was a virtual package or not: * :: %s: requires %s, provided by %s */ - printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss), - depstring); + printf(_(":: %s: requires %s\n"), miss->target, depstring); free(depstring); } break; -- cgit v1.2.3