Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-19 14:28:35 +1200
committerAllan McRae <allan@archlinux.org>2018-09-19 17:04:38 +1000
commitb54b33d816cdc3d1aab3b80f4eb94c5bad56c889 (patch)
tree98580eaaed8f177e415cb6d294bd8bdc603308cb
parent3d5a056452fe897e533edfac2ddbe2d1ca702a6e (diff)
Change if-else chain to switch
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--lib/libalpm/sync.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 696a5131..65a853dc 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -1176,17 +1176,23 @@ static int check_validity(alpm_handle_t *handle,
if(errors) {
for(i = errors; i; i = i->next) {
struct validity *v = i->data;
- if(v->error == ALPM_ERR_PKG_MISSING_SIG) {
- _alpm_log(handle, ALPM_LOG_ERROR,
- _("%s: missing required signature\n"), v->pkg->name);
- } else if(v->error == ALPM_ERR_PKG_INVALID_SIG) {
- _alpm_process_siglist(handle, v->pkg->name, v->siglist,
- v->siglevel & ALPM_SIG_PACKAGE_OPTIONAL,
- v->siglevel & ALPM_SIG_PACKAGE_MARGINAL_OK,
- v->siglevel & ALPM_SIG_PACKAGE_UNKNOWN_OK);
- prompt_to_delete(handle, v->path, v->error);
- } else if(v->error == ALPM_ERR_PKG_INVALID_CHECKSUM) {
- prompt_to_delete(handle, v->path, v->error);
+ switch(v->error) {
+ case ALPM_ERR_PKG_MISSING_SIG:
+ _alpm_log(handle, ALPM_LOG_ERROR,
+ _("%s: missing required signature\n"), v->pkg->name);
+ break;
+ case ALPM_ERR_PKG_INVALID_SIG:
+ _alpm_process_siglist(handle, v->pkg->name, v->siglist,
+ v->siglevel & ALPM_SIG_PACKAGE_OPTIONAL,
+ v->siglevel & ALPM_SIG_PACKAGE_MARGINAL_OK,
+ v->siglevel & ALPM_SIG_PACKAGE_UNKNOWN_OK);
+ /* fallthrough */
+ case ALPM_ERR_PKG_INVALID_CHECKSUM:
+ prompt_to_delete(handle, v->path, v->error);
+ break;
+ default:
+ /* ignore */
+ break;
}
alpm_siglist_cleanup(v->siglist);
free(v->siglist);