Change if-else chain to switch

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
David Phillips 2018-09-19 14:28:35 +12:00 committed by Allan McRae
parent 3d5a056452
commit b54b33d816

View file

@ -1176,17 +1176,23 @@ static int check_validity(alpm_handle_t *handle,
if(errors) { if(errors) {
for(i = errors; i; i = i->next) { for(i = errors; i; i = i->next) {
struct validity *v = i->data; struct validity *v = i->data;
if(v->error == ALPM_ERR_PKG_MISSING_SIG) { switch(v->error) {
_alpm_log(handle, ALPM_LOG_ERROR, case ALPM_ERR_PKG_MISSING_SIG:
_("%s: missing required signature\n"), v->pkg->name); _alpm_log(handle, ALPM_LOG_ERROR,
} else if(v->error == ALPM_ERR_PKG_INVALID_SIG) { _("%s: missing required signature\n"), v->pkg->name);
_alpm_process_siglist(handle, v->pkg->name, v->siglist, break;
v->siglevel & ALPM_SIG_PACKAGE_OPTIONAL, case ALPM_ERR_PKG_INVALID_SIG:
v->siglevel & ALPM_SIG_PACKAGE_MARGINAL_OK, _alpm_process_siglist(handle, v->pkg->name, v->siglist,
v->siglevel & ALPM_SIG_PACKAGE_UNKNOWN_OK); v->siglevel & ALPM_SIG_PACKAGE_OPTIONAL,
prompt_to_delete(handle, v->path, v->error); v->siglevel & ALPM_SIG_PACKAGE_MARGINAL_OK,
} else if(v->error == ALPM_ERR_PKG_INVALID_CHECKSUM) { v->siglevel & ALPM_SIG_PACKAGE_UNKNOWN_OK);
prompt_to_delete(handle, v->path, v->error); /* fallthrough */
case ALPM_ERR_PKG_INVALID_CHECKSUM:
prompt_to_delete(handle, v->path, v->error);
break;
default:
/* ignore */
break;
} }
alpm_siglist_cleanup(v->siglist); alpm_siglist_cleanup(v->siglist);
free(v->siglist); free(v->siglist);