Re: [Mesa-dev] [PATCH V2 03/15] mesa: Add a clone function to mesa hash

2013-08-28 Thread Brian Paul

On 08/27/2013 08:39 PM, Timothy Arceri wrote:

V2: const qualify table parameter

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
---
  src/mesa/main/hash.c |   28 
  src/mesa/main/hash.h |3 +++
  2 files changed, 31 insertions(+)



Reviewed-by: Brian Paul bri...@vmware.com

Do you need someone to commit/push your patches for you?

-Brian

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH V2 03/15] mesa: Add a clone function to mesa hash

2013-08-28 Thread Timothy Arceri
- Original Message -

From: Brian Paul bri...@vmware.com

On 08/27/2013 08:39 PM, Timothy Arceri wrote:
 V2: const qualify table parameter

 Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
 ---
   src/mesa/main/hash.c |   28 
   src/mesa/main/hash.h |    3 +++
   2 files changed, 31 insertions(+)


Reviewed-by: Brian Paul bri...@vmware.com

Do you need someone to commit/push your patches for you?

-Brian

Hi Brian,

Yes I need someone to commit for me.

Tim

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH V2 03/15] mesa: Add a clone function to mesa hash

2013-08-27 Thread Timothy Arceri
V2: const qualify table parameter

Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au
---
 src/mesa/main/hash.c |   28 
 src/mesa/main/hash.h |3 +++
 2 files changed, 31 insertions(+)

diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 6591af9..b31fd48 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -302,6 +302,34 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
 
 
 /**
+ * Clone all entries in a hash table, into a new table.
+ *
+ * \param table  the hash table to clone
+ */
+struct _mesa_HashTable *
+_mesa_HashClone(const struct _mesa_HashTable *table)
+{
+   /* cast-away const */
+   struct _mesa_HashTable *table2 = (struct _mesa_HashTable *) table;
+   struct hash_entry *entry;
+   struct _mesa_HashTable *clonetable;
+
+   ASSERT(table);
+   _glthread_LOCK_MUTEX(table2-Mutex);
+
+   clonetable = _mesa_NewHashTable();
+   assert(clonetable);
+   hash_table_foreach(table-ht, entry) {
+  _mesa_HashInsert(clonetable, (GLint)(uintptr_t)entry-key, entry-data);
+   }
+
+   _glthread_UNLOCK_MUTEX(table2-Mutex);
+
+   return clonetable;
+}
+
+
+/**
  * Walk over all entries in a hash table, calling callback function for each.
  * Note: we use a separate mutex in this function to avoid a recursive
  * locking deadlock (in case the callback calls _mesa_HashRemove()) and to
diff --git a/src/mesa/main/hash.h b/src/mesa/main/hash.h
index 142d284..b34f328 100644
--- a/src/mesa/main/hash.h
+++ b/src/mesa/main/hash.h
@@ -50,6 +50,9 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
 void (*callback)(GLuint key, void *data, void *userData),
 void *userData);
 
+extern struct _mesa_HashTable *
+_mesa_HashClone(const struct _mesa_HashTable *table);
+
 extern void
 _mesa_HashWalk(const struct _mesa_HashTable *table,
void (*callback)(GLuint key, void *data, void *userData),
-- 
1.7.9.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev