Hi all I just checked in the new fusion hash and property support for
fusion objects.
Adding it should not break anything.

I also converted all uses of the hash table to use the new hash but
I'm not checking that in yet.
Instead I've attached the patch. I've tested with no problems but its
a basic change so I hesitate to make it.

Attached is the patch.

Next steps are to add I think Get/SetProperty to at least the window interface.

Comming soon.

Mike
? lib/fusion/shared_hash.loT
Index: interfaces/IDirectFBFont/idirectfbfont_default.c
===================================================================
RCS file: /cvs/directfb/DirectFB/interfaces/IDirectFBFont/idirectfbfont_default.c,v
retrieving revision 1.38
diff -u -r1.38 idirectfbfont_default.c
--- interfaces/IDirectFBFont/idirectfbfont_default.c	22 Jul 2006 18:46:29 -0000	1.38
+++ interfaces/IDirectFBFont/idirectfbfont_default.c	22 Jul 2006 20:25:13 -0000
@@ -38,7 +38,7 @@
 
 #include <media/idirectfbfont.h>
 
-#include <direct/hash.h>
+#include <fusion/hash.h>
 
 #include <direct/interface.h>
 #include <direct/mem.h>
@@ -181,7 +181,7 @@
                     else
                          key = index;
 
-                    direct_hash_insert( font->glyph_hash, key, data );
+                    fusion_hash_insert( font->glyph_hash, (const void *)key, data );
 
                     start = i + 1;
                     index++;
@@ -201,7 +201,7 @@
           else
                key = index;
 
-          direct_hash_insert( font->glyph_hash, key, data );
+          fusion_hash_insert( font->glyph_hash, (const void *)key, data );
      }
 
      dfb_surface_soft_lock( surface, DSLF_WRITE, &dst, &pitch, 0 );
Index: lib/direct/Makefile.am
===================================================================
RCS file: /cvs/directfb/DirectFB/lib/direct/Makefile.am,v
retrieving revision 1.23
diff -u -r1.23 Makefile.am
--- lib/direct/Makefile.am	21 Sep 2005 16:10:11 -0000	1.23
+++ lib/direct/Makefile.am	22 Jul 2006 20:25:13 -0000
@@ -52,7 +52,6 @@
 	cpu_accel.h			\
 	debug.h				\
 	direct.h			\
-	hash.h				\
 	interface.h			\
 	interface_implementation.h	\
 	list.h				\
@@ -82,7 +81,6 @@
 	cpu_accel.c		\
 	debug.c			\
 	direct.c		\
-	hash.c			\
 	interface.c		\
 	list.c			\
 	log.c			\
Index: lib/direct/hash.c
===================================================================
RCS file: /cvs/directfb/DirectFB/lib/direct/hash.c,v
retrieving revision 1.5
diff -u -r1.5 hash.c
--- lib/direct/hash.c	10 Jul 2006 22:39:57 -0000	1.5
+++ lib/direct/hash.c	22 Jul 2006 20:25:13 -0000
@@ -1,4 +1,7 @@
 /*
+   GLIB - Library of useful routines for C programming
+   Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+
    (c) Copyright 2000-2002  convergence integrated media GmbH.
    (c) Copyright 2002-2004  convergence GmbH.
 
@@ -8,6 +11,7 @@
               Andreas Hundt <[EMAIL PROTECTED]>,
               Sven Neumann <[EMAIL PROTECTED]> and
               Ville Syrjälä <[EMAIL PROTECTED]>.
+              Michael Emmel <[EMAIL PROTECTED]>.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -25,9 +29,17 @@
    Boston, MA 02111-1307, USA.
 */
 
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
 #include <config.h>
 
 #include <stdlib.h>
+#include <string.h>
 
 #include <direct/debug.h>
 #include <direct/hash.h>
@@ -37,231 +49,465 @@
 
 D_DEBUG_DOMAIN( Direct_Hash, "Direct/Hash", "Hash table implementation" );
 
+#define HASH_TABLE_MIN_SIZE 11
+#define HASH_TABLE_MAX_SIZE 13845163
 
-#define REMOVED  ((void *) -1)
-
-typedef struct {
-     __u32     key;
-     void     *value;
-} Element;
 
-struct __D_DirectHash {
-     int       magic;
+typedef struct _HashNode  HashNode;
 
-     int       size;
-
-     int       count;
-     int       removed;
+struct _HashNode
+{
+  void      *key;
+  void      *value;
+  HashNode *next;
+};
 
-     Element  *elements;
+struct __D_DirectHash 
+{
+  int       magic;
+  DirectHashType key_type;
+  DirectHashType value_type;
+  int             size;
+  int             nnodes;
+  HashNode      **nodes;
 };
 
-/**************************************************************************************************/
 
-static inline int
-locate_key( const DirectHash *hash, __u32 key )
+static const unsigned int primes[] =
 {
-     int            pos;
-     const Element *element;
+  11,
+  19,
+  37,
+  73,
+  109,
+  163,
+  251,
+  367,
+  557,
+  823,
+  1237,
+  1861,
+  2777,
+  4177,
+  6247,
+  9371,
+  14057,
+  21089,
+  31627,
+  47431,
+  71143,
+  106721,
+  160073,
+  240101,
+  360163,
+  540217,
+  810343,
+  1215497,
+  1823231,
+  2734867,
+  4102283,
+  6153409,
+  9230113,
+  13845163,
+};
 
-     pos = key % hash->size;
 
-     element = &hash->elements[pos];
+static HashNode** hash_lookup_node  (DirectHash     *hash,
+                                                   const void *   key);
 
-     while (element->value) {
-          if (element->value != REMOVED && element->key == key)
-               return pos;
+static void hash_node_destroy(DirectHash *hash,
+                HashNode *hash_node,void **old_key, void **old_value);
 
-          if (++pos == hash->size)
-               pos = 0;
 
-          element = &hash->elements[pos];
-     }
+static const unsigned int nprimes = sizeof (primes) / sizeof (primes[0]);
 
-     return -1;
+unsigned int
+spaced_primes_closest (unsigned int num)
+{
+  int i;
+  for (i = 0; i < nprimes; i++)
+    if (primes[i] > num)
+      return primes[i];
+  return primes[nprimes - 1];
 }
 
-/**************************************************************************************************/
-
-DirectResult
-direct_hash_create( int          size,
-                    DirectHash **ret_hash )
+/**
+ * direct_hash_create:
+ * @type: Type of hash key the hash is optimized for strings ints and pointers 
+ * @size: Inital size of the hash table 
+ * @ret_hash:the new hash table
+ * Creates a new #DirectHash with a reference count of 1.
+ * 
+ * Return value: a new #DirectHash.
+ **/
+DirectResult  
+direct_hash_create (DirectHashType key_type, DirectHashType value_type,
+                int  size, DirectHash **ret_hash )
 {
-     DirectHash *hash;
+    DirectHash *hash;
+
+    if( !ret_hash )
+        return DFB_BUG;
 
-     if (size < 17)
-          size = 17;
+    if (size < HASH_TABLE_MIN_SIZE)
+        size = HASH_TABLE_MIN_SIZE;
 
-     D_DEBUG_AT( Direct_Hash, "Creating hash table with initial capacity of %d...\n", size );
+    hash = D_CALLOC( 1, sizeof (DirectHash) );
 
-     hash = D_CALLOC( 1, sizeof (DirectHash) );
-     if (!hash) {
+    if (!hash) {
           D_WARN( "out of memory" );
           return DFB_NOSYSTEMMEMORY;
-     }
+    }
 
-     hash->size     = size;
-     hash->elements = D_CALLOC( size, sizeof(Element) );
+    hash->key_type           =  key_type;
+    hash->value_type         =  value_type;
+    hash->size               =  size;
+    hash->nnodes             = 0;
+    hash->nodes = D_CALLOC(size,sizeof(HashNode*) );
 
-     if (!hash->elements) {
-          D_WARN( "out of memory" );
-          D_FREE( hash );
-          return DFB_NOSYSTEMMEMORY;
-     }
+    if (!hash->nodes) {
+        D_WARN( "out of memory" );
+        D_FREE( hash );
+        return DFB_NOSYSTEMMEMORY;
+    }
 
-     D_MAGIC_SET( hash, DirectHash );
+    D_MAGIC_SET(hash,DirectHash );
 
-     *ret_hash = hash;
+    *ret_hash = hash;
 
-     return DFB_OK;
+    return DFB_OK;
 }
 
 void
 direct_hash_destroy( DirectHash *hash )
 {
+     int i;
+     HashNode *node;
      D_MAGIC_ASSERT( hash, DirectHash );
 
+     for (i=0; i<hash->size; i++) {
+        for (node = hash->nodes[i]; node; node = node->next){
+            hash_node_destroy(hash,node,NULL,NULL);
+        }
+     }
      D_MAGIC_CLEAR( hash );
-
-     D_FREE( hash->elements );
+     D_FREE( hash->nodes );
      D_FREE( hash );
 }
 
-DirectResult
-direct_hash_insert( DirectHash *hash,
-                    __u32       key,
-                    void       *value )
+static inline HashNode**
+hash_lookup_node (DirectHash	*hash,
+			  const void *	 key)
 {
-     int      pos;
-     Element *element;
+  HashNode **node;
+ 
+  /*TODO We could also optimize pointer hashing*/ 
+  if (hash->key_type == HASH_STRING )
+  {
+    /* 31 bit hash function */
+    const signed char *p = key;
+    unsigned int h = *p;
+    if (h)
+        for (p += 1; *p != '\0'; p++)
+        h = (h << 5) - h + *p;
+
+    node = &hash->nodes[h % hash->size];
+  } 
+  else
+    node = &hash->nodes[((unsigned int)key) % hash->size];
+  
+    /* Hash table lookup needs to be fast.
+     *  We therefore remove the extra conditional of testing
+     *  whether to call the key_equal_func or not from
+     *  the inner loop.
+     */
+    if (hash->key_type == HASH_STRING ) {
+        while(*node && strcmp((const char *)(*node)->key,(const char*)key))
+            node = &(*node)->next;
+    }
+    else
+        while (*node && (*node)->key != key)
+            node = &(*node)->next;
 
-     D_MAGIC_ASSERT( hash, DirectHash );
-     D_ASSERT( value != NULL );
+  return node;
 
-     /* Need to resize the hash table? */
-     if ((hash->count + hash->removed) > hash->size / 4) {
-          int      i, size = hash->size * 3;
-          Element *elements;
-
-          D_DEBUG_AT( Direct_Hash, "Resizing from %d to %d... (count %d, removed %d)\n",
-                      hash->size, size, hash->count, hash->removed );
-
-          elements = D_CALLOC( size, sizeof(Element) );
-          if (!elements) {
-               D_WARN( "out of memory" );
-               return DFB_NOSYSTEMMEMORY;
-          }
-
-          for (i=0; i<hash->size; i++) {
-               Element *element = &hash->elements[i];
-               Element *insertElement;
-
-               if (element->value && element->value != REMOVED) {
-                    pos = element->key % size;
-
-                    insertElement = &elements[pos];
-                    while (insertElement->value && insertElement->value != REMOVED) {
-                        if (++pos == size)
-                            pos = 0;
-                        insertElement = &elements[pos];
-                    }
-
-                    elements[pos] = *element;
-               }
-          }
-
-          D_FREE( hash->elements );
-
-          hash->size     = size;
-          hash->elements = elements;
-          hash->removed  = 0;
-     }
-
-     pos = key % hash->size;
-
-     D_DEBUG_AT( Direct_Hash, "Attempting to insert key 0x%08x at position %d...\n", key, pos );
-
-     element = &hash->elements[pos];
-
-     while (element->value && element->value != REMOVED) {
-          if (element->key == key) {
-               D_BUG( "key already exists" );
-               return DFB_BUG;
-          }
+}
 
-          if (++pos == hash->size)
-               pos = 0;
+/**
+ * direct_hash_lookup:
+ * @hash: a #DirectHash.
+ * @key: the key to look up.
+ * 
+ * Looks up a key in a #DirectHash. Note that this function cannot
+ * distinguish between a key that is not present and one which is present
+ * and has the value %NULL. If you need this distinction, use
+ * hash_lookup_extended().
+ * 
+ * Return value: the associated value, or %NULL if the key is not found.
+ **/
+void *
+direct_hash_lookup (DirectHash *hash, const void * key)
+{
+  HashNode *node;
+  D_MAGIC_ASSERT( hash, DirectHash );
+  node = *hash_lookup_node (hash,key);
+  return node ? node->value : NULL;
+}
 
-          element = &hash->elements[pos];
-     }
+/**
+ * direct_hash_insert:
+ * @hash: a #DirectHash.
+ * @key: a key to insert.
+ * @value: the value to associate with the key.
+ * 
+ * Inserts a new key and value into a #DirectHash.
+ * If the key already exists in the #DirectHash DFB_BUG is returned 
+ * If you think a key may exist you should call direct_hash_replace
+ * Generally this is only used on a new DirectHash
+ **/
+DirectResult
+direct_hash_insert( DirectHash *hash,
+                    void       *key,
+                    void       *value )
+{
+  HashNode **node;
+  D_MAGIC_ASSERT( hash, DirectHash );
+  
+  node = hash_lookup_node (hash, key);
+  
+  if (*node)
+    {
+      D_BUG( "key already exists" );
+      return DFB_BUG;
+    }
+  else
+    {
+      (*node) = D_CALLOC(1,sizeof(HashNode));
+      if(!(*node) )
+        return DFB_NOSYSTEMMEMORY;
+      (*node)->key = key;
+      (*node)->value = value;
+      hash->nnodes++;
+      if( direct_hash_should_resize(hash) )
+        direct_hash_resize(hash);
+    }
+    return DFB_OK;
+}
 
-     if (element->value == REMOVED)
-          hash->removed--;
+/**
+ * hash_replace:
+ * @hash: a #DirectHash.
+ * @key: a key to insert.
+ * @value: the value to associate with the key.
+ * 
+ * Inserts a new key and value into a #DirectHash similar to 
+ * hash_insert(). The difference is that if the key already exists 
+ * in the #DirectHash, it gets replaced by the new key. 
+ * If you supplied a  oldkey pointer or oldkey value they are returned
+ * otherwise free is called the key if table type is not type HASH_INT
+ * and free is called on the old value if not supplied
+ **/
+DirectResult
+direct_hash_replace (DirectHash *hash,
+		      void *	  key,
+		      void *	  value, 
+              void **old_key,
+              void **old_value)
+{
+    HashNode **node;
+    D_MAGIC_ASSERT( hash, DirectHash );
 
-     element->key   = key;
-     element->value = value;
+    node = hash_lookup_node (hash, key);
 
-     hash->count++;
+    if (*node)
+    {
+      if( old_key)
+            *old_key = (*node)->key;
+      else if( hash->key_type != HASH_INT )
+            D_FREE((*node)->key );
+      if( old_value)
+            *old_value = (*node)->value;
+      else if( hash->value_type != HASH_INT )
+            D_FREE((*node)->value );
+    }else {
+        *node = D_CALLOC(1,sizeof(HashNode));
+        if(!(*node) )
+            return DFB_NOSYSTEMMEMORY;
+
+        hash->nnodes++;
+    }
+    (*node)->key = key;
+    (*node)->value = value;
+    return DFB_OK;
+}
 
-     D_DEBUG_AT( Direct_Hash, "...inserted at %d, new count = %d, removed = %d, size = %d, key = 0x%08x.\n",
-                 pos, hash->count, hash->removed, hash->size, key );
+/**
+ * direct_hash_remove:
+ * @hash: a #DirectHash.
+ * @key: the key to remove.
+ * @old_key: returned old_key 
+ * @old_value: returned old_value 
+ * Removes a key and its associated value from a #DirectHash.
+ *
+ * If the #DirectHash was created using hash_new_full(), the
+ * key and value are freed using the supplied destroy functions, otherwise
+ * you have to make sure that any dynamically allocated values are freed 
+ * yourself.
+ * If you supplied a  oldkey pointer or oldkey value they are returned
+ * otherwise free is called the key if table type is not type HASH_INT
+ * and free is called on the old value if not supplied
+ * 
+ * Return value: %TRUE if the key was found and removed from the #DirectHash.
+ * Note the hash table is not resized on removes
+ **/
+bool
+direct_hash_remove (DirectHash	   *hash,
+		     const void *  key, void **old_key, void **old_value)
+{
+  HashNode **node, *dest;
+  D_MAGIC_ASSERT( hash,DirectHash );
+  
+  node = hash_lookup_node (hash, key);
+  if (*node)
+    {
+      dest = *node;
+      (*node) = dest->next;
+      hash_node_destroy(hash,dest,old_key,old_value);
+      hash->nnodes--;
+      return true;
+    }
 
-     return DFB_OK;
+  return false;
 }
 
+/**
+ * hash_foreach:
+ * @hash: a #DirectHash.
+ * @func: the function to call for each key/value pair.
+ * @user_data: user data to pass to the function.
+ * 
+ * Calls the given function for each of the key/value pairs in the
+ * #DirectHash.  The function is passed the key and value of each
+ * pair, and the given @user_data parameter.  The hash table may not
+ * be modified while iterating over it (you can't add/remove
+ * items). To remove all items matching a predicate, use
+ * hash_foreach_remove().
+ **/
 void
-direct_hash_remove( DirectHash  *hash,
-                    __u32        key )
+direct_hash_iterate( DirectHash             *hash,
+                     DirectHashIteratorFunc  func,
+                     void                   *ctx )
 {
-     int pos;
+     int i;
+     int count=0;
+     HashNode *node;
 
      D_MAGIC_ASSERT( hash, DirectHash );
 
-     pos = locate_key( hash, key );
-     if (pos == -1) {
-          D_WARN( "key not found" );
-          return;
+     for (i=0; i<hash->size; i++) {
+        for (node = hash->nodes[i]; node; node = node->next){
+            if( func(hash,node->key, node->value,ctx))
+                    return;
+            count++;
+            if( count == hash->nnodes )
+                return;
+        }
      }
-
-     hash->elements[pos].value = REMOVED;
-
-     hash->count--;
-     hash->removed++;
-
-     D_DEBUG_AT( Direct_Hash, "Removed key 0x%08x at %d, new count = %d, removed = %d, size = %d.\n",
-                 key, pos, hash->count, hash->removed, hash->size );
 }
 
-void *
-direct_hash_lookup( DirectHash *hash,
-                    __u32       key )
+/**
+ * hash_size:
+ * @hash: a #DirectHash.
+ * 
+ * Returns the number of elements contained in the #DirectHash.
+ * 
+ * Return value: the number of key/value pairs in the #DirectHash.
+ **/
+unsigned int
+direct_hash_size (DirectHash *hash)
 {
-     int pos;
-
-     D_MAGIC_ASSERT( hash, DirectHash );
-
-     pos = locate_key( hash, key );
+  D_MAGIC_ASSERT( hash, DirectHash );
+  return hash->nnodes;
+}
 
-     return (pos != -1) ? hash->elements[pos].value : NULL;
+/**
+ * direct_hash_should_resize:
+ * Call the function after adding or removing several
+ * values it has a decent heurisitc to determine if
+ * the hash has grown to large
+ */
+bool direct_hash_should_resize ( DirectHash    *hash)
+{
+  D_MAGIC_ASSERT( hash, DirectHash );
+   if ((hash->size >= 3 * hash->nnodes &&	       
+	  hash->size > HASH_TABLE_MIN_SIZE) ||		
+	 (3 * hash->size <= hash->nnodes &&	       
+	  hash->size < HASH_TABLE_MAX_SIZE))		
+             return true;
+   return false;
 }
 
+/* Hash Functions
+ * Resize the hash to minumim for this number of entries
+ */
 void
-direct_hash_iterate( DirectHash             *hash,
-                     DirectHashIteratorFunc  func,
-                     void                   *ctx )
+direct_hash_resize (DirectHash *hash)
 {
-     int i;
-
-     D_MAGIC_ASSERT( hash, DirectHash );
+    HashNode **new_nodes;
+    HashNode *node;
+    HashNode *next;
+    unsigned int hash_val;
+    int new_size;
+    int i;
+    D_MAGIC_ASSERT( hash, DirectHash );
+
+    new_size = spaced_primes_closest (hash->nnodes);
+    if(new_size > HASH_TABLE_MAX_SIZE )
+        new_size = HASH_TABLE_MAX_SIZE;
+    if(new_size <  HASH_TABLE_MIN_SIZE)
+        new_size = HASH_TABLE_MIN_SIZE;
+ 
+    new_nodes = D_CALLOC (new_size,sizeof(HashNode*));
+  
+    for (i = 0; i < hash->size; i++)
+        for (node = hash->nodes[i]; node; node = next) {
+	        next = node->next;
+            /*TODO We could also optimize pointer hashing*/ 
+            if (hash->key_type == HASH_STRING ) {
+                /* 31 bit hash function */
+                const signed char *p = node->key;
+                unsigned int h = *p;
+                if (h)
+                    for (p += 1; *p != '\0'; p++)
+                h = (h << 5) - h + *p;
+                hash_val=h%new_size;
+            } 
+            else
+                hash_val = ((unsigned int)node->key)%new_size;
+
+	        node->next = new_nodes[hash_val];
+	        new_nodes[hash_val] = node;
+        }
+  
+    D_FREE(hash->nodes);
+    hash->nodes = new_nodes;
+    hash->size = new_size;
+}
 
-     for (i=0; i<hash->size; i++) {
-          Element *element = &hash->elements[i];
 
-          if (!element->value || element->value == REMOVED)
-               continue;
+static void
+hash_node_destroy (DirectHash *hash,HashNode *node, 
+                void **old_key,void **old_value)
+{
 
-          if (!func( hash, element->key, element->value, ctx ) )
-               return;
-     }
+     if( old_key)
+            *old_key = node->key;
+      else if( hash->key_type != HASH_INT )
+            D_FREE(node->key );
+      if( old_value)
+            *old_value = node->value;
+      else if( hash->value_type != HASH_INT )
+            D_FREE(node->value );
+      D_FREE(node);
 }
 
Index: lib/direct/hash.h
===================================================================
RCS file: /cvs/directfb/DirectFB/lib/direct/hash.h,v
retrieving revision 1.1
diff -u -r1.1 hash.h
--- lib/direct/hash.h	29 Apr 2004 19:08:39 -0000	1.1
+++ lib/direct/hash.h	22 Jul 2006 20:25:13 -0000
@@ -1,4 +1,6 @@
 /*
+    GLIB - Library of useful routines for C programming
+    Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
    (c) Copyright 2000-2002  convergence integrated media GmbH.
    (c) Copyright 2002-2004  convergence GmbH.
 
@@ -8,6 +10,7 @@
               Andreas Hundt <[EMAIL PROTECTED]>,
               Sven Neumann <[EMAIL PROTECTED]> and
               Ville Syrjälä <[EMAIL PROTECTED]>.
+              Michael Emmel <[EMAIL PROTECTED]>.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -25,36 +28,69 @@
    Boston, MA 02111-1307, USA.
 */
 
-#ifndef __DIRECT__HASH_H__
-#define __DIRECT__HASH_H__
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#ifndef __DIRECT_HASH_H__
+#define __DIRECT_HASH_H__
 
 #include <direct/types.h>
 
+typedef enum {
+        HASH_PTR,
+        HASH_STRING,
+        HASH_INT
+}DirectHashType;
 
 typedef bool (*DirectHashIteratorFunc)( DirectHash *hash,
-                                        __u32       key,
+                                        void       *key,
                                         void       *value,
                                         void       *ctx );
 
 
-DirectResult  direct_hash_create ( int          size,
-                                   DirectHash **ret_hash );
+void direct_hash_resize (DirectHash  *hash);
+
+DirectResult  
+direct_hash_create (DirectHashType key_type,DirectHashType key_val,
+                int  size, DirectHash **ret_hash );
+
+void
+direct_hash_destroy( DirectHash *hash );
+
+void *
+direct_hash_lookup (DirectHash *hash, const void * key);
+
+DirectResult
+direct_hash_insert( DirectHash *hash,
+                    void       *key,
+                    void       *value );
+
+DirectResult
+direct_hash_replace (DirectHash *hash_table,
+		      void *	  key,
+		      void *	  value, void **oldKey,void **oldValue);
+
+bool
+direct_hash_remove (DirectHash	   *hash,
+		     const void *  key, void **old_key, void **old_value);
 
-void          direct_hash_destroy( DirectHash  *hash );
+void
+direct_hash_iterate( DirectHash             *hash,
+                     DirectHashIteratorFunc  func,
+                     void                   *ctx );
 
-DirectResult  direct_hash_insert ( DirectHash  *hash,
-                                   __u32        key,
-                                   void        *value );
+unsigned int
+direct_hash_size (DirectHash *hash);
 
-void          direct_hash_remove ( DirectHash  *hash,
-                                   __u32        key );
+bool direct_hash_should_resize ( DirectHash    *hash);
 
-void         *direct_hash_lookup ( DirectHash  *hash,
-                                   __u32        key );
+void
+direct_hash_resize (DirectHash *hash);
 
-void          direct_hash_iterate( DirectHash             *hash,
-                                   DirectHashIteratorFunc  func,
-                                   void                   *ctx );
 
-#endif
+#endif /* __DIRECT_HASH_H__ */
 
Index: lib/voodoo/manager.c
===================================================================
RCS file: /cvs/directfb/DirectFB/lib/voodoo/manager.c,v
retrieving revision 1.12
diff -u -r1.12 manager.c
--- lib/voodoo/manager.c	3 Jul 2006 16:40:40 -0000	1.12
+++ lib/voodoo/manager.c	22 Jul 2006 20:25:13 -0000
@@ -45,7 +45,6 @@
 
 #include <direct/clock.h>
 #include <direct/debug.h>
-#include <direct/hash.h>
 #include <direct/interface.h>
 #include <direct/list.h>
 #include <direct/mem.h>
@@ -53,6 +52,7 @@
 #include <direct/messages.h>
 #include <direct/thread.h>
 #include <direct/util.h>
+#include <fusion/hash.h>
 
 #include <voodoo/internal.h>
 #include <voodoo/manager.h>
@@ -89,8 +89,8 @@
 
      struct {
           pthread_mutex_t        lock;
-          DirectHash            *local;
-          DirectHash            *remote;
+          FusionHash            *local;
+          FusionHash            *remote;
           VoodooInstanceID       last;
      } instances;
 
@@ -197,16 +197,16 @@
      DUMP_SOCKET_OPTION( SO_RCVBUF );
 
      /* Create the hash table for dispatcher instances. */
-     ret = direct_hash_create( 251, &manager->instances.local );
+     ret = fusion_hash_create_local(HASH_INT,HASH_PTR, 251, &manager->instances.local );
      if (ret) {
           D_FREE( manager );
           return ret;
      }
 
      /* Create the hash table for requestor instances. */
-     ret = direct_hash_create( 251, &manager->instances.remote );
+     ret = fusion_hash_create_local( HASH_INT,HASH_PTR,251, &manager->instances.remote );
      if (ret) {
-          direct_hash_destroy( manager->instances.local );
+          fusion_hash_destroy( manager->instances.local );
           D_FREE( manager );
           return ret;
      }
@@ -281,8 +281,8 @@
 }
 
 static bool
-instance_iterator( DirectHash *hash,
-                   __u32       key,
+instance_iterator( FusionHash *hash,
+                   void       *key,
                    void       *value,
                    void       *ctx )
 {
@@ -354,11 +354,11 @@
      pthread_mutex_destroy( &manager->output.lock );
 
      /* Release all remaining interfaces. */
-     direct_hash_iterate( manager->instances.local, instance_iterator, (void*) false );
-     direct_hash_iterate( manager->instances.local, instance_iterator, (void*) true );
-     direct_hash_destroy( manager->instances.local );
+     fusion_hash_iterate( manager->instances.local, instance_iterator, (void*) false );
+     fusion_hash_iterate( manager->instances.local, instance_iterator, (void*) true );
+     fusion_hash_destroy( manager->instances.local );
 
-     direct_hash_destroy( manager->instances.remote );
+     fusion_hash_destroy( manager->instances.remote );
 
      D_MAGIC_CLEAR( manager );
 
@@ -774,7 +774,7 @@
 
      instance_id = ++manager->instances.last;
 
-     ret = direct_hash_insert( manager->instances.local, instance_id, instance );
+     ret = fusion_hash_insert( manager->instances.local, (void *)instance_id, instance );
 
      pthread_mutex_unlock( &manager->instances.lock );
 
@@ -806,7 +806,7 @@
 
      pthread_mutex_lock( &manager->instances.lock );
 
-     instance = direct_hash_lookup( manager->instances.local, instance_id );
+     instance = fusion_hash_lookup( manager->instances.local, (void *)instance_id );
 
      pthread_mutex_unlock( &manager->instances.lock );
 
@@ -846,7 +846,7 @@
 
      pthread_mutex_lock( &manager->instances.lock );
 
-     ret = direct_hash_insert( manager->instances.remote, instance_id, instance );
+     ret = fusion_hash_insert( manager->instances.remote, (void *)instance_id, instance );
 
      pthread_mutex_unlock( &manager->instances.lock );
 
@@ -876,7 +876,7 @@
 
      pthread_mutex_lock( &manager->instances.lock );
 
-     instance = direct_hash_lookup( manager->instances.remote, instance_id );
+     instance = fusion_hash_lookup( manager->instances.remote,(void *)instance_id );
 
      pthread_mutex_unlock( &manager->instances.lock );
 
@@ -997,7 +997,7 @@
 
      pthread_mutex_lock( &manager->instances.lock );
 
-     instance = direct_hash_lookup( manager->instances.local, request->instance );
+     instance = fusion_hash_lookup(manager->instances.local, (void *)request->instance );
      if (!instance) {
           pthread_mutex_unlock( &manager->instances.lock );
 
Index: src/core/fonts.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/fonts.c,v
retrieving revision 1.58
diff -u -r1.58 fonts.c
--- src/core/fonts.c	22 Jul 2006 18:46:29 -0000	1.58
+++ src/core/fonts.c	22 Jul 2006 20:25:14 -0000
@@ -43,11 +43,11 @@
 #include <core/surfaces.h>
 
 #include <direct/debug.h>
-#include <direct/hash.h>
 #include <direct/mem.h>
 #include <direct/messages.h>
 #include <direct/utf8.h>
 #include <direct/util.h>
+#include <fusion/hash.h>
 
 #include <gfx/convert.h>
 
@@ -75,7 +75,7 @@
      if (!font)
           return D_OOM();
 
-     ret = direct_hash_create( 163, &font->glyph_hash );
+     ret = fusion_hash_create_local(HASH_INT,HASH_PTR,163, &font->glyph_hash );
      if (ret) {
           D_FREE( font );
           return ret;
@@ -121,7 +121,7 @@
 
      dfb_state_destroy( &font->state );
 
-     direct_hash_destroy( font->glyph_hash );
+     fusion_hash_destroy( font->glyph_hash );
 
      if (font->rows) {
           for (i = 0; i < font->num_rows; i++) {
@@ -204,7 +204,7 @@
           D_ASSERT( font->active_row < font->num_rows );
      }
 
-     data = direct_hash_lookup( font->glyph_hash, index );
+     data = fusion_hash_lookup( font->glyph_hash, (const void *)index );
      if (data) {
           D_MAGIC_ASSERT( data, CoreGlyphData );
           D_ASSERT( data->row >= 0 );
@@ -333,7 +333,7 @@
                     direct_list_foreach_safe (d, n, row->glyphs) {
                          D_MAGIC_ASSERT( d, CoreGlyphData );
 
-                         /*ret =*/ direct_hash_remove( font->glyph_hash, d->index );
+                         /*ret =*/ fusion_hash_remove( font->glyph_hash, (const void *)d->index,NULL,(void **)&d);
                          //FIXME: use D_ASSERT( ret == DFB_OK );
 
                          D_MAGIC_CLEAR( d );
@@ -416,7 +416,7 @@
      if (row)
           direct_list_append( &row->glyphs, &data->link );
 
-     direct_hash_insert( font->glyph_hash, index, data );
+     fusion_hash_insert( font->glyph_hash, (const void *)index, data );
 
      *ret_data = data;
 
Index: src/core/fonts.h
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/fonts.h,v
retrieving revision 1.25
diff -u -r1.25 fonts.h
--- src/core/fonts.h	22 Jul 2006 18:46:29 -0000	1.25
+++ src/core/fonts.h	22 Jul 2006 20:25:14 -0000
@@ -109,7 +109,7 @@
      int                           active_row;
      unsigned int                  row_stamp;
 
-     DirectHash                   *glyph_hash;    /* infos about loaded glyphs        */
+     FusionHash                   *glyph_hash;    /* infos about loaded glyphs        */
 
      int                           height;        /* font height                      */
 
Index: src/core/gfxcard.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/gfxcard.c,v
retrieving revision 1.185
diff -u -r1.185 gfxcard.c
--- src/core/gfxcard.c	22 Jul 2006 11:19:09 -0000	1.185
+++ src/core/gfxcard.c	22 Jul 2006 20:25:15 -0000
@@ -54,12 +54,12 @@
 #include <gfx/clip.h>
 #include <gfx/util.h>
 
-#include <direct/hash.h>
 #include <direct/mem.h>
 #include <direct/messages.h>
 #include <direct/modules.h>
 #include <direct/utf8.h>
 #include <direct/util.h>
+#include <fusion/hash.h>
 
 #include <misc/conf.h>
 #include <misc/util.h>
@@ -1532,7 +1532,7 @@
           CoreGlyphData *glyph;
           unsigned int   current = indices[i];
 
-          glyph = direct_hash_lookup( font->glyph_hash, current );
+          glyph = fusion_hash_lookup( font->glyph_hash,(const void *) current );
           if (!glyph) {
                switch (blit) {
                     case 1:
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to