Simplify various BIO_sock_* fuctions - less code, better variable names,
correct types and fewer casts.

ok deraadt@ miod@
More KNF.
KNF.
Avoid locking in BIO_get_port() by using getservbyname_r() instead of
getservbyname(). While here, provide a common/single return path.

ok deraadt@
More KNF.