]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/tools/build/src/engine/hash.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / tools / build / src / engine / hash.h
index 7ed633d7317ab3f072e49860fb38ca09ffa9c45d..4088894e3cc22cd71e826a21c006c75fa8b62bb1 100644 (file)
@@ -4,6 +4,12 @@
  * This file is part of Jam - see jam.c for Copyright information.
  */
 
+/*  This file is ALSO:
+ *  Copyright 2022 RenĂ© Ferdinand Rivera Morell
+ *  Distributed under the Boost Software License, Version 1.0.
+ *  (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+ */
+
 /*
  * hash.h - simple in-memory hashing routines
  */
@@ -28,7 +34,7 @@ typedef struct hashdata HASHDATA;
  *   datalen - item size
  *   name    - used for debugging
  */
-struct hash * hashinit( int datalen, char const * name );
+struct hash * hashinit( int32_t datalen, char const * name );
 
 /*
  * hash_free() - free a hash table, given its handle
@@ -36,12 +42,25 @@ struct hash * hashinit( int datalen, char const * name );
 void hash_free( struct hash * );
 void hashdone( struct hash * );
 
+typedef void (* hashenumerate_f)( void *, void * );
+
 /*
  * hashenumerate() - call f(i, data) on each item, i in the hash table. The
  * enumeration order is unspecified.
  */
 void hashenumerate( struct hash *, void (* f)( void *, void * ), void * data );
 
+template <typename T, typename D>
+void hash_enumerate( struct hash * h, void (* f)(T *, D *), D * data)
+{
+    hashenumerate(h, reinterpret_cast<hashenumerate_f>(f), data);
+}
+template <typename T, typename D>
+void hash_enumerate( struct hash * h, void (* f)(T *, D *))
+{
+    hashenumerate(h, reinterpret_cast<hashenumerate_f>(f), nullptr);
+}
+
 /*
  * hash_insert() - insert a new item in a hash table, or return an existing one.
  *
@@ -57,7 +76,7 @@ void hashenumerate( struct hash *, void (* f)( void *, void * ), void * data );
  *   - if the key is present then *found == 1 and the result is a pointer to the
  *     existing record.
  */
-HASHDATA * hash_insert( struct hash *, OBJECT * key, int * found );
+HASHDATA * hash_insert( struct hash *, OBJECT * key, int32_t * found );
 
 /*
  * hash_find() - find a record in the table or NULL if none exists