diff options
author | 2020-09-25 10:56:36 +0000 | |
---|---|---|
committer | 2020-09-25 10:56:36 +0000 | |
commit | 7f00cb0d87faf1c7fed1b25c38ee4c46444e8ba3 (patch) | |
tree | 5b56375ab128d10254384b50c76ccb5bbe9f4213 /lib/libcrypto/ui/ui_lib.c | |
parent | The default branch of a switch somehow got moved inside of a pointless (diff) | |
download | wireguard-openbsd-7f00cb0d87faf1c7fed1b25c38ee4c46444e8ba3.tar.xz wireguard-openbsd-7f00cb0d87faf1c7fed1b25c38ee4c46444e8ba3.zip |
Move variable declaration to the top of UI_set_result and ditch
a pointless local scope.
suggested by jsing
Diffstat (limited to 'lib/libcrypto/ui/ui_lib.c')
-rw-r--r-- | lib/libcrypto/ui/ui_lib.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/lib/libcrypto/ui/ui_lib.c b/lib/libcrypto/ui/ui_lib.c index 106a38fa8a2..1e3a4ee7051 100644 --- a/lib/libcrypto/ui/ui_lib.c +++ b/lib/libcrypto/ui/ui_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ui_lib.c,v 1.40 2020/09/25 10:50:26 tb Exp $ */ +/* $OpenBSD: ui_lib.c,v 1.41 2020/09/25 10:56:36 tb Exp $ */ /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL * project 2001. */ @@ -775,6 +775,7 @@ UI_get_result_maxsize(UI_STRING *uis) int UI_set_result(UI *ui, UI_STRING *uis, const char *result) { + const char *p; int l = strlen(result); ui->flags &= ~UI_FLAG_REDOABLE; @@ -810,25 +811,21 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result) uis->_.string_data.result_maxsize + 1); break; case UIT_BOOLEAN: - { - const char *p; - - if (!uis->result_buf) { - UIerror(UI_R_NO_RESULT_BUFFER); - return -1; + if (!uis->result_buf) { + UIerror(UI_R_NO_RESULT_BUFFER); + return -1; + } + uis->result_buf[0] = '\0'; + for (p = result; *p; p++) { + if (strchr(uis->_.boolean_data.ok_chars, *p)) { + uis->result_buf[0] = + uis->_.boolean_data.ok_chars[0]; + break; } - uis->result_buf[0] = '\0'; - for (p = result; *p; p++) { - if (strchr(uis->_.boolean_data.ok_chars, *p)) { - uis->result_buf[0] = - uis->_.boolean_data.ok_chars[0]; - break; - } - if (strchr(uis->_.boolean_data.cancel_chars, *p)) { - uis->result_buf[0] = - uis->_.boolean_data.cancel_chars[0]; - break; - } + if (strchr(uis->_.boolean_data.cancel_chars, *p)) { + uis->result_buf[0] = + uis->_.boolean_data.cancel_chars[0]; + break; } } default: |