Use static inline functions instead of preprocessor macros

C99 has support for proper inline functions, so use it. Also, annotate more
functions with GCC/Clang extended attributes, to improve error reporting and
type checks done by the compiler.
Use (more) static inline functions instead of preprocessor macros
wtnetstr: Abuse the preprocessor to generate code

The w_tnetstr_* are quite regular in terms of API and operation mode,
so it is possible to factor out generation of their code and let the
preprocessor do the job.