[haiku-commits] r35231 - haiku/trunk/headers/private/kernel/util

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 21 Jan 2010 23:16:03 +0100 (CET)

Author: bonefish
Date: 2010-01-21 23:16:03 +0100 (Thu, 21 Jan 2010)
New Revision: 35231
Changeset: http://dev.haiku-os.org/changeset/35231/haiku

Modified:
   haiku/trunk/headers/private/kernel/util/OpenHashTable.h
Log:
Resize(): Added boolean "force" parameter that allows to force setting the
new memory, even if it isn't needed at that time.


Modified: haiku/trunk/headers/private/kernel/util/OpenHashTable.h
===================================================================
--- haiku/trunk/headers/private/kernel/util/OpenHashTable.h     2010-01-21 
20:03:44 UTC (rev 35230)
+++ haiku/trunk/headers/private/kernel/util/OpenHashTable.h     2010-01-21 
22:16:03 UTC (rev 35231)
@@ -255,12 +255,14 @@
        /*!     Resizes the table using the given allocation. The allocation 
must not
                be \c NULL. It must be of size \a size, which must a value 
returned
                earlier by ResizeNeeded(). If the size requirements have 
changed in the
-               meantime, the method free()s the given allocation and returns 
\c false.
+               meantime, the method free()s the given allocation and returns 
\c false,
+               unless \a force is \c true, in which case the supplied 
allocation is
+               used in any event.
                Otherwise \c true is returned.
        */
-       bool Resize(void* allocation, size_t size)
+       bool Resize(void* allocation, size_t size, bool force = false)
        {
-               if (size != ResizeNeeded()) {
+               if (!force && size != ResizeNeeded()) {
                        free(allocation);
                        return false;
                }


Other related posts:

  • » [haiku-commits] r35231 - haiku/trunk/headers/private/kernel/util - ingo_weinhold