From 27acdc2c94de558103eb29260c179a49c9b05c14 Mon Sep 17 00:00:00 2001 From: Stefano Esposito Date: Sat, 8 Sep 2007 18:41:45 +0200 Subject: make alpm_strerror binding friendly I'm currently working on python bindings for alpm written in pyrex. While working i found that declaring alpm_strerror as char * alpm_strerror (void) instead of char * alpm_strerror (int err) and then using pm_errno in the implementation instead of err, could make it more bindings-friendly. Dan: cleaned up and added void to declaration. Instead of replacing existing function, add a new function called 'alpm_strerrorlast(void)'. Signed-off-by: Stefano Esposito Signed-off-by: Dan McGee --- src/pacman/remove.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/pacman/remove.c') diff --git a/src/pacman/remove.c b/src/pacman/remove.c index e60d3e8c..860bf491 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -44,7 +44,7 @@ static int remove_cleanup(void) int ret = alpm_trans_release(); if(ret != 0) { pm_printf(PM_LOG_ERROR, _("failed to release transaction (%s)\n"), - alpm_strerror(pm_errno)); + alpm_strerrorlast()); ret = 1; } @@ -97,7 +97,7 @@ int pacman_remove(alpm_list_t *targets) if(alpm_trans_init(PM_TRANS_TYPE_REMOVE, config->flags, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) { fprintf(stderr, _("error: failed to init transaction (%s)\n"), - alpm_strerror(pm_errno)); + alpm_strerrorlast()); if(pm_errno == PM_ERR_HANDLE_LOCK) { printf(_(" if you're sure a package manager is not already\n" " running, you can remove %s.\n"), alpm_option_get_lockfile()); @@ -113,7 +113,7 @@ int pacman_remove(alpm_list_t *targets) if(alpm_trans_addtarget(targ) == -1) { printf("failed.\n"); fprintf(stderr, _("error: failed to add target '%s' (%s)\n"), targ, - alpm_strerror(pm_errno)); + alpm_strerrorlast()); remove_cleanup(); FREELIST(finaltargs); return(1); @@ -123,7 +123,7 @@ int pacman_remove(alpm_list_t *targets) /* Step 2: prepare the transaction based on its type, targets and flags */ if(alpm_trans_prepare(&data) == -1) { fprintf(stderr, _("error: failed to prepare transaction (%s)\n"), - alpm_strerror(pm_errno)); + alpm_strerrorlast()); switch(pm_errno) { case PM_ERR_UNSATISFIED_DEPS: for(i = data; i; i = alpm_list_next(i)) { @@ -167,7 +167,7 @@ int pacman_remove(alpm_list_t *targets) /* Step 3: actually perform the removal */ if(alpm_trans_commit(NULL) == -1) { fprintf(stderr, _("error: failed to commit transaction (%s)\n"), - alpm_strerror(pm_errno)); + alpm_strerrorlast()); remove_cleanup(); FREELIST(finaltargs); return(1); -- cgit v1.2.3