summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pl_newhashtable.rst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /docs/nspr/reference/pl_newhashtable.rst
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/nspr/reference/pl_newhashtable.rst')
-rw-r--r--docs/nspr/reference/pl_newhashtable.rst67
1 files changed, 67 insertions, 0 deletions
diff --git a/docs/nspr/reference/pl_newhashtable.rst b/docs/nspr/reference/pl_newhashtable.rst
new file mode 100644
index 0000000000..d4479284c5
--- /dev/null
+++ b/docs/nspr/reference/pl_newhashtable.rst
@@ -0,0 +1,67 @@
+PL_NewHashTable
+===============
+
+Create a new hash table.
+
+
+Syntax
+------
+
+.. code::
+
+ #include <plhash.h>
+
+ PLHashTable *PL_NewHashTable(
+ PRUint32 numBuckets,
+ PLHashFunction keyHash,
+ PLHashComparator keyCompare,
+ PLHashComparator valueCompare,
+ const PLHashAllocOps *allocOps,
+ void *allocPriv
+ );
+
+
+Parameters
+~~~~~~~~~~
+
+The function has the following parameters:
+
+``numBuckets``
+ The number of buckets in the hash table.
+``keyHash``
+ Hash function.
+``keyCompare``
+ Function used to compare keys of entries.
+``valueCompare``
+ Function used to compare keys of entries.
+``allocOps``
+ A pointer to a ``PLHashAllocOps`` structure that must exist
+ throughout the lifetime of the new hash table.
+``allocPriv``
+ Passed as the first argument (pool).
+
+
+Returns
+~~~~~~~
+
+The new hash table.
+
+
+Description
+-----------
+
+:ref:`PL_NewHashTable` creates a new hash table. The table has at least 16
+buckets. You can pass a value of 0 as ``numBuckets`` to create the
+default number of buckets in the new table. The arguments ``keyCompare``
+and ``valueCompare`` are functions of type :ref:`PLHashComparator` that the
+hash table library functions use to compare the keys and the values of
+entries.
+
+The argument ``allocOps`` points to a ``PLHashAllocOps`` structure that
+must exist throughout the lifetime of the new hash table. The hash table
+library functions do not make a copy of this structure. When the
+allocation functions in ``allocOps`` are invoked, the allocation private
+data allocPriv is passed as the first argument (pool). You can specify a
+``NULL`` value for ``allocOps`` to use the default allocation functions.
+If ``allocOps`` is ``NULL``, ``allocPriv`` is ignored. Note that the
+default ``freeEntry`` function does not free the value of the entry.