# define MAX(a,b) ((a) < (b) ? (b) : (a))
# define MIN(a,b) ((a) < (b) ? (a) : (b))
+/* Use this with care. If the compiler can't see the array
+ * definition, it obviously won't produce a correct result. */
+#define mutt_array_size(x) (sizeof (x) / sizeof ((x)[0]))
+
/* For mutt_format_string() justifications */
/* Making left 0 and center -1 is of course completely nonsensical, but
* it retains compatibility for any patches that call mutt_format_string.
int done, row, i;
FILE *fp;
- menu->max = 23;
+ menu->max = mutt_array_size (part) * 2 + 9;
menu->dialog = (char **) safe_calloc (1, menu->max * sizeof (char *));
for (i = 0; i < menu->max; i++)
menu->dialog[i] = (char *) safe_calloc (1, SHORT_STRING * sizeof (char));
strfcpy (menu->dialog[row], _("This certificate belongs to:"), SHORT_STRING);
row++;
x509_subject = X509_get_subject_name (cert);
- for (i = 0; i < 7; i++)
+ for (i = 0; i < mutt_array_size (part); i++)
snprintf (menu->dialog[row++], SHORT_STRING, " %s",
x509_get_part (x509_subject, part[i]));
strfcpy (menu->dialog[row], _("This certificate was issued by:"), SHORT_STRING);
row++;
x509_issuer = X509_get_issuer_name (cert);
- for (i = 0; i < 7; i++)
+ for (i = 0; i < mutt_array_size (part); i++)
snprintf (menu->dialog[row++], SHORT_STRING, " %s",
x509_get_part (x509_issuer, part[i]));