add single instance mode
[uwplayer.git] / ucx / cx / hash_map.h
index cfa5f96..a7a94ce 100644 (file)
@@ -70,11 +70,11 @@ struct cx_hash_map_s {
  *
  * If \p buckets is zero, an implementation defined default will be used.
  *
- * If \p itemsize is CX_STORE_POINTERS, the created map will be created as if
+ * If \p item_size is CX_STORE_POINTERS, the created map will be created as if
  * cxMapStorePointers() was called immediately after creation.
  *
  * @note Iterators provided by this hash map implementation provide the remove operation.
- * The index value of an iterator is the incremented when the iterator advanced without removal.
+ * The index value of an iterator is incremented when the iterator advanced without removal.
  * In other words, when the iterator is finished, \c index==size .
  *
  * @param allocator the allocator to use
@@ -84,12 +84,28 @@ struct cx_hash_map_s {
  */
 __attribute__((__nonnull__, __warn_unused_result__))
 CxMap *cxHashMapCreate(
-        CxAllocator *allocator,
+        CxAllocator const *allocator,
         size_t itemsize,
         size_t buckets
 );
 
 /**
+ * Creates a new hash map with a default number of buckets.
+ *
+ * If \p item_size is CX_STORE_POINTERS, the created map will be created as if
+ * cxMapStorePointers() was called immediately after creation.
+ *
+ * @note Iterators provided by this hash map implementation provide the remove operation.
+ * The index value of an iterator is incremented when the iterator advanced without removal.
+ * In other words, when the iterator is finished, \c index==size .
+ *
+ * @param itemsize the size of one element
+ * @return a pointer to the new hash map
+ */
+#define cxHashMapCreateSimple(itemsize) \
+    cxHashMapCreate(cxDefaultAllocator, itemsize, 0)
+
+/**
  * Increases the number of buckets, if necessary.
  *
  * The load threshold is \c 0.75*buckets. If the element count exceeds the load