summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/plhashenumerator.rst
blob: eba3635c5e381cc7ca37126140ec86d750f37d97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Syntax
------

.. code::

   #include <plhash.h>

   typedef PRIntn (PR_CALLBACK *PLHashEnumerator)(PLHashEntry *he, PRIntn index, void *arg);

   /* Return value */
   #define HT_ENUMERATE_NEXT     0   /* continue enumerating entries */
   #define HT_ENUMERATE_STOP     1   /* stop enumerating entries */
   #define HT_ENUMERATE_REMOVE   2   /* remove and free the current entry */
   #define HT_ENUMERATE_UNHASH   4   /* just unhash the current entry */


Description
-----------

``PLHashEnumerator`` is a function type used in the enumerating a hash
table. When all the table entries are enumerated, each entry is passed
to a user-specified function of type ``PLHashEnumerator`` with the hash
table entry, an integer index, and an arbitrary piece of user data as
argument.


Remark
------

The meaning of ``HT_ENUMERATE_UNHASH`` is not clear. In the current
implementation, it will leave the hash table in an inconsistent state.
The entries are unlinked from the table, they are not freed, but the
entry count (the ``nentries`` field of the ``PLHashTable`` structure) is
not decremented.


See Also
--------

:ref:`PL_HashTableEnumerateEntries`