Simplify code.
authorNeal H. Walfield <neal@gnu.org>
Mon, 11 May 2015 14:35:12 +0000 (16:35 +0200)
committerNeal H. Walfield <neal@gnu.org>
Tue, 12 May 2015 13:47:53 +0000 (15:47 +0200)
* pinentry/pinentry.c (cmd_confirm): Don't use nested ternary
expressions.

pinentry/pinentry.c

index 11a8027..3a44851 100644 (file)
@@ -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;
 }