Minor cleanup in getaddrinfo

Replace repeated computations of alloca size with a local variable
that stores the computed value.
Consolidate pthread_attr value validation

Define inline functions that wrap around validation for each of the
pthread attributes to reduce duplication in code.