Re: [PHP4BETA] *_r -functions

From: Date: Sun, 28 Nov 1999 19:14:16 +0000
Subject: Re: [PHP4BETA] *_r -functions
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-6996@lists.php.net to get a copy of this message
On Sun, 28 Nov 1999, Sascha Schumann wrote: > Yes, the getxxbyzz functions are not so easy to cover. For > gethostbyname_r, we should support the three APIs (Solaris, > glibc2, HP-UX) by providing a wrapper function, so that our > functions can use a php_gethostbyname_r with known semantics. > > The fallback function you created does not check for error > conditions (gethostbyname() may return NULL), nor does it > respect the lowest common denominator which is: > > int gethostbyname_r(const char *host, struct hostent *hostbuf, > char *tmphostbuf, size_t tmphostbuflen, > int *hosterr); Very good points. Have to think it over again. And maybe just leave it, I don't have enough documentation about the different APIs. Oh, and I just left the error checking upper in the function chain. if (result || !hp || !hp->h_addr_list) works, although I forgot to free a buffer. However, it doesn't disqualify your points... > The function also does not consider that the hostent > structure contains pointers to other fields. These pointers > point to statically allocated memory, thus we need to copy > their contents as well. Why? We don't use them to anything. - Jouni

« previous php.version4 (#6996) next »