Rationalise access to, and content of, backends[] array.
[u/mdw/putty] / mac / mac.c
index 9e1d1f3..2536206 100644 (file)
--- a/mac/mac.c
+++ b/mac/mac.c
@@ -210,13 +210,10 @@ static void mac_startup(void) {
     default_protocol = be_default_protocol;
     /* Find the appropriate default port. */
     {
-       int i;
+       Backend *b = backend_from_proto(default_protocol);
        default_port = 0; /* illegal */
-       for (i = 0; backends[i].backend != NULL; i++)
-           if (backends[i].protocol == default_protocol) {
-               default_port = backends[i].backend->default_port;
-               break;
-           }
+       if (b)
+           default_port = b->default_port;
     }
     flags = FLAG_INTERACTIVE;