diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /docs/nspr/reference/plhashallocops.rst | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/nspr/reference/plhashallocops.rst')
-rw-r--r-- | docs/nspr/reference/plhashallocops.rst | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/docs/nspr/reference/plhashallocops.rst b/docs/nspr/reference/plhashallocops.rst new file mode 100644 index 0000000000..02cceb9c2b --- /dev/null +++ b/docs/nspr/reference/plhashallocops.rst @@ -0,0 +1,40 @@ + +Syntax +------ + +.. code:: + + #include <plhash.h> + + typedef struct PLHashAllocOps { + void *(PR_CALLBACK *allocTable)(void *pool, PRSize size); + void (PR_CALLBACK *freeTable)(void *pool, void *item); + PLHashEntry *(PR_CALLBACK *allocEntry)(void *pool, const void *key); + void (PR_CALLBACK *freeEntry)(void *pool, PLHashEntry *he, PRUintn flag); + } PLHashAllocOps; + + #define HT_FREE_VALUE 0 /* just free the entry's value */ + #define HT_FREE_ENTRY 1 /* free value and entire entry */ + + +Description +----------- + +Users of the hash table functions can provide their own memory +allocation functions. A pair of functions is used to allocate and tree +the table, and another pair of functions is used to allocate and free +the table entries. + +The first argument, pool, for all four functions is a void \* pointer +that is a piece of data for the memory allocator. Typically pool points +to a memory pool used by the memory allocator. + +The ``freeEntry`` function does not need to free the value of the entry. +If flag is ``HT_FREE_ENTRY``, the function frees the entry. + + +Remark +------ + +The ``key`` argument for the ``allocEntry`` function does not seem to be +useful. It is unused in the default ``allocEntry`` function. |