some extensions for nginx

Igor Sysoev is at rambler-co.ru
Tue Aug 21 16:02:35 MSD 2007


On Tue, Aug 21, 2007 at 01:33:50PM +0200, Manlio Perillo wrote:

> Igor Sysoev ha scritto:
> >On Tue, Aug 21, 2007 at 01:15:25PM +0200, Manlio Perillo wrote:
> >
> >>Manlio Perillo ha scritto:
> >>>Hi Igor.
> >>>
> >>>I have wrote some reusable functions for dealing with "foreign" C 
> >>>libraries.
> >>>
> >>>You can find the code here:
> >>>http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/ngx_ext.c
> >>>
> >>I have a question: should I deallocate the memory for the "original" 
> >>string?
> >
> >If allocation is made from a pool, then you do not need to free it.
> >
> 
> How are they freed? With a garbage collector?

On the end of request, connection, nginx life cycle depending on pool life.

> >BTW, in ngx_conf_set_c_str_slot() value[1].data points to already
> >zero-terminated string, so you do not need to reallocated it.
> 
> Ok, thanks.
> Does all ngx_str_t strings have an '\0' at the end of the data buffer?
> 
> If this is the case, I have written the code for nothing....

No, ngx_str_t usually has no '\0', but in some case it has.
For example, all value's at configuration phase has it.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list