You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-crypt/pinentry/files/pinentry-0.9.2-simplify.patch

49 lines
1.4 KiB

From 831782b3b625ca81624fae0ee184da0d2fc46d96 Mon Sep 17 00:00:00 2001
From: "Neal H. Walfield" <neal@gnu.org>
Date: Mon, 11 May 2015 16:35:12 +0200
Subject: [PATCH 1/1] Simplify code.
* pinentry/pinentry.c (cmd_confirm): Don't use nested ternary
expressions.
---
pinentry/pinentry.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
index 11a8027..3a44851 100644
--- a/pinentry/pinentry.c
+++ b/pinentry/pinentry.c
@@ -1132,14 +1132,21 @@ cmd_confirm (ASSUAN_CONTEXT ctx, char *line)
if (pinentry.close_button)
assuan_write_status (ctx, "BUTTON_INFO", "close");
- return result ? 0
- : (pinentry.specific_err? pinentry.specific_err :
- pinentry.locale_err? ASSUAN_Locale_Problem
- : (pinentry.one_button
- ? 0
- : (pinentry.canceled
- ? ASSUAN_Canceled
- : ASSUAN_Not_Confirmed)));
+ if (result)
+ return 0;
+
+ if (pinentry.specific_err)
+ return pinentry.specific_err;
+
+ if (pinentry.locale_err)
+ return ASSUAN_Locale_Problem;
+
+ if (pinentry.one_button)
+ return 0;
+
+ if (pinentry.canceled)
+ return ASSUAN_Canceled;
+ return ASSUAN_Not_Confirmed;
}
--
2.1.4