[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [users@httpd] APR Table vs. Hash & Array vs. Skip List vs. Ring

> On 27 May 2018, at 03:40, Simon Walter <simon@xxxxxxxxxx> wrote:
> Hi everyone,
> First of all, I am not sure if this is the right place to ask this.
> Please send me to the appropriate mailing list. Thanks.

What's the context?  Given where you asked, I'll guess you're writing
a module for your web server, in which case, there's a modules-dev list
for the next question.

> I want to know basically what the difference is between a table and a
> hash table - regarding the APR implementation.

The best place to look at APR is the source header files, which are the
level at which it's most comprehensively documented and easy to follow.

> The one difference that stands out to me is that I can iterate over a
> hash. So is a hash like a table with a linked list?


> Perhaps a table can also be iterated over too. I haven't used tables yet

You can iterate over a table, too: use its underlying array.

>  I see function names containing
> "merge" and "append", but the docs do not state how this is done.

The docs in the header files are pretty clear.

Also worth bearing in mind, apr_table's more esoteric functions originate in the
standards for manipulating HTTP headers.  If in doubt, assume the behaviour
follows HTTP.

Why not start with the simple: a C array of pointers void* my_array[N_ELTS],
or a linked list?  Once you've thought through the problems with those, you're
in a position to decide what struct will best serve you.

FWIW, the situation where I find an APR array helps most often over a linked
list is in making life easier in a configuration merge function.

Nick Kew
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx

( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache2-users/msg02645.html on line 118
Call Stack
10.0009364552{main}( ).../msg02645.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache2-users/msg02645.html on line 118
Call Stack
10.0009364552{main}( ).../msg02645.html:0