diff options
author | marha <marha@users.sourceforge.net> | 2013-09-04 16:27:02 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-09-04 16:27:02 +0200 |
commit | b828531d8b6da75a258d12f97df0f4e49f75ab98 (patch) | |
tree | fcb5da3afc321bb34cdfd8cd84dfd986a1f59083 /mesalib/src/mesa/main/hash.c | |
parent | 9e382b6be0e81397f18ec0b733a2e88dc3465a33 (diff) | |
download | vcxsrv-b828531d8b6da75a258d12f97df0f4e49f75ab98.tar.gz vcxsrv-b828531d8b6da75a258d12f97df0f4e49f75ab98.tar.bz2 vcxsrv-b828531d8b6da75a258d12f97df0f4e49f75ab98.zip |
fontconfig xkeyboard-config git update 4 Sep 2013
xkeyboard-config commit 8f49c92c54c53eab6d40d8be90ce06773d20d196
fontconfig commit 6720892e97f11fbe8d69ae5b3875d928c68ff90e
mesa commit 51a279254fecc05691524dab1bf291c7dfefccd5
Diffstat (limited to 'mesalib/src/mesa/main/hash.c')
-rw-r--r-- | mesalib/src/mesa/main/hash.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/hash.c b/mesalib/src/mesa/main/hash.c index 6591af9a6..b31fd4839 100644 --- a/mesalib/src/mesa/main/hash.c +++ b/mesalib/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 |