You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Damir Dezeljin <pr...@mbss.org> on 2003/02/17 15:32:48 UTC

Question about apr_sockaddr_ip_get()

Hi.

I want to retrive an IP addr string from the apr_sockaddr_t so I used
apr_sockaddr_ip_get(). The first argument of this function is char ** .
Because I have to add a pointer to a pointer I think that the function
allocate automaticaly the memory for the destination char * . On the other
hand the function hasn't any apr_pool input parameter. However one
apr_pool is stored inside apr_sockaddr_t variable.

So the question is ... do I have to first alocate the memory for the
destination string?
If yes ... how much memory do I have to alocate (16 * sizeof(char) like in
samples or more so that IPv6 addresses can also fit inside the buffer)?

Regards,
Dezo


Re: Question about apr_sockaddr_ip_get()

Posted by Jeff Trawick <tr...@attglobal.net>.
Damir Dezeljin wrote:

> I want to retrive an IP addr string from the apr_sockaddr_t so I used
> apr_sockaddr_ip_get(). The first argument of this function is char ** .

...

> So the question is ... do I have to first alocate the memory for the
> destination string?


APR allocates the storage from the pool for the apr_sockaddr_t.  You 
don't have to do any preparation.

I'll add a comment to that effect to the description of the function.

Thanks,

Jeff