Welcome! Log In Create A New Profile

Advanced

Re: ngx_list_free

Maxim Dounin
April 18, 2023 08:36AM
Hello!

On Tue, Apr 18, 2023 at 06:14:46AM +0000, Yuval Abadi via nginx wrote:

> Ngx_list_t have create api but no free_list api
>
> Why?
>
> I wrote my own free_list, is anyone else face this issue?

Much like many things in nginx, ngx_list_t structure is an
append-only structure, and it is expected to be used as a list of
items being added. Most notably, ngx_list_t is used for request
headers (these are added to the list when they are parsed), and
response headers (these are added when they are generated
internally).

If you have to remove an item for some reason (which shouldn't be
common case for legitimate usage, but might happen to be needed
occasionally), the common approach is to use a "skip" flag in the
structures being listed. For example, response headers are
cleared by setting the "hash" field to 0, so such headers are
ignored by the code iterating over the list.

If you need something more dynamic in your code, ngx_list_t might
not be the right structure to use. Something like ngx_queue_t or
ngx_rbtree_t might be a better choice.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

ngx_list_free

Yuval Abadi via nginx April 18, 2023 02:16AM

Re: ngx_list_free

Maxim Dounin April 18, 2023 08:36AM

RE: ngx_list_free

Yuval Abadi via nginx April 18, 2023 11:14AM

Re: ngx_list_free

Maxim Dounin April 18, 2023 02:44PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 228
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready