mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 23:46:17 +01:00
reverted the g_hash_table_set_key_freefunc() addition, since it's to
Thu Nov 26 01:36:20 1998 Tim Janik <timj@gtk.org> * glib.h: * ghash.c: reverted the g_hash_table_set_key_freefunc() addition, since it's to specialized and needs to be resolved in a generic fashion.
This commit is contained in:
parent
bf75878819
commit
3a14f25fdf
@ -1,3 +1,10 @@
|
|||||||
|
Thu Nov 26 01:36:20 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h:
|
||||||
|
* ghash.c: reverted the g_hash_table_set_key_freefunc() addition,
|
||||||
|
since it's to specialized and needs to be resolved in a generic
|
||||||
|
fashion.
|
||||||
|
|
||||||
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* applied glib-tml-981120-0, change log appended below.
|
* applied glib-tml-981120-0, change log appended below.
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Thu Nov 26 01:36:20 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h:
|
||||||
|
* ghash.c: reverted the g_hash_table_set_key_freefunc() addition,
|
||||||
|
since it's to specialized and needs to be resolved in a generic
|
||||||
|
fashion.
|
||||||
|
|
||||||
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* applied glib-tml-981120-0, change log appended below.
|
* applied glib-tml-981120-0, change log appended below.
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Thu Nov 26 01:36:20 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h:
|
||||||
|
* ghash.c: reverted the g_hash_table_set_key_freefunc() addition,
|
||||||
|
since it's to specialized and needs to be resolved in a generic
|
||||||
|
fashion.
|
||||||
|
|
||||||
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* applied glib-tml-981120-0, change log appended below.
|
* applied glib-tml-981120-0, change log appended below.
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Thu Nov 26 01:36:20 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h:
|
||||||
|
* ghash.c: reverted the g_hash_table_set_key_freefunc() addition,
|
||||||
|
since it's to specialized and needs to be resolved in a generic
|
||||||
|
fashion.
|
||||||
|
|
||||||
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* applied glib-tml-981120-0, change log appended below.
|
* applied glib-tml-981120-0, change log appended below.
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Thu Nov 26 01:36:20 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h:
|
||||||
|
* ghash.c: reverted the g_hash_table_set_key_freefunc() addition,
|
||||||
|
since it's to specialized and needs to be resolved in a generic
|
||||||
|
fashion.
|
||||||
|
|
||||||
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* applied glib-tml-981120-0, change log appended below.
|
* applied glib-tml-981120-0, change log appended below.
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Thu Nov 26 01:36:20 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h:
|
||||||
|
* ghash.c: reverted the g_hash_table_set_key_freefunc() addition,
|
||||||
|
since it's to specialized and needs to be resolved in a generic
|
||||||
|
fashion.
|
||||||
|
|
||||||
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* applied glib-tml-981120-0, change log appended below.
|
* applied glib-tml-981120-0, change log appended below.
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Thu Nov 26 01:36:20 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h:
|
||||||
|
* ghash.c: reverted the g_hash_table_set_key_freefunc() addition,
|
||||||
|
since it's to specialized and needs to be resolved in a generic
|
||||||
|
fashion.
|
||||||
|
|
||||||
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* applied glib-tml-981120-0, change log appended below.
|
* applied glib-tml-981120-0, change log appended below.
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Thu Nov 26 01:36:20 1998 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib.h:
|
||||||
|
* ghash.c: reverted the g_hash_table_set_key_freefunc() addition,
|
||||||
|
since it's to specialized and needs to be resolved in a generic
|
||||||
|
fashion.
|
||||||
|
|
||||||
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
Tue Nov 24 18:57:59 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* applied glib-tml-981120-0, change log appended below.
|
* applied glib-tml-981120-0, change log appended below.
|
||||||
|
30
ghash.c
30
ghash.c
@ -40,7 +40,6 @@ struct _GHashTable
|
|||||||
GHashNode **nodes;
|
GHashNode **nodes;
|
||||||
GHashFunc hash_func;
|
GHashFunc hash_func;
|
||||||
GCompareFunc key_compare_func;
|
GCompareFunc key_compare_func;
|
||||||
GFreeFunc *free_func;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -49,10 +48,8 @@ static GHashNode** g_hash_table_lookup_node (GHashTable *hash_table,
|
|||||||
gconstpointer key);
|
gconstpointer key);
|
||||||
static GHashNode* g_hash_node_new (gpointer key,
|
static GHashNode* g_hash_node_new (gpointer key,
|
||||||
gpointer value);
|
gpointer value);
|
||||||
static void g_hash_node_destroy (GHashNode *hash_node,
|
static void g_hash_node_destroy (GHashNode *hash_node);
|
||||||
GFreeFunc *free_func);
|
static void g_hash_nodes_destroy (GHashNode *hash_node);
|
||||||
static void g_hash_nodes_destroy (GHashNode *hash_node,
|
|
||||||
GFreeFunc *free_func);
|
|
||||||
|
|
||||||
|
|
||||||
static GMemChunk *node_mem_chunk = NULL;
|
static GMemChunk *node_mem_chunk = NULL;
|
||||||
@ -73,7 +70,6 @@ g_hash_table_new (GHashFunc hash_func,
|
|||||||
hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
|
hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
|
||||||
hash_table->key_compare_func = key_compare_func;
|
hash_table->key_compare_func = key_compare_func;
|
||||||
hash_table->nodes = g_new (GHashNode*, hash_table->size);
|
hash_table->nodes = g_new (GHashNode*, hash_table->size);
|
||||||
hash_table->free_func = NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < hash_table->size; i++)
|
for (i = 0; i < hash_table->size; i++)
|
||||||
hash_table->nodes[i] = NULL;
|
hash_table->nodes[i] = NULL;
|
||||||
@ -89,7 +85,7 @@ g_hash_table_destroy (GHashTable *hash_table)
|
|||||||
g_return_if_fail (hash_table != NULL);
|
g_return_if_fail (hash_table != NULL);
|
||||||
|
|
||||||
for (i = 0; i < hash_table->size; i++)
|
for (i = 0; i < hash_table->size; i++)
|
||||||
g_hash_nodes_destroy (hash_table->nodes[i], hash_table->free_func);
|
g_hash_nodes_destroy (hash_table->nodes[i]);
|
||||||
|
|
||||||
g_free (hash_table->nodes);
|
g_free (hash_table->nodes);
|
||||||
g_free (hash_table);
|
g_free (hash_table);
|
||||||
@ -174,7 +170,7 @@ g_hash_table_remove (GHashTable *hash_table,
|
|||||||
{
|
{
|
||||||
dest = *node;
|
dest = *node;
|
||||||
(*node) = dest->next;
|
(*node) = dest->next;
|
||||||
g_hash_node_destroy (dest, hash_table->free_func);
|
g_hash_node_destroy (dest);
|
||||||
hash_table->nnodes--;
|
hash_table->nnodes--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,13 +249,13 @@ g_hash_table_foreach_remove (GHashTable *hash_table,
|
|||||||
if (prev)
|
if (prev)
|
||||||
{
|
{
|
||||||
prev->next = node->next;
|
prev->next = node->next;
|
||||||
g_hash_node_destroy (node, hash_table->free_func);
|
g_hash_node_destroy (node);
|
||||||
node = prev;
|
node = prev;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hash_table->nodes[i] = node->next;
|
hash_table->nodes[i] = node->next;
|
||||||
g_hash_node_destroy (node, hash_table->free_func);
|
g_hash_node_destroy (node);
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,12 +293,6 @@ g_hash_table_size (GHashTable *hash_table)
|
|||||||
return hash_table->nnodes;
|
return hash_table->nnodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
g_hash_table_set_key_freefunc (GHashTable *hash_table, GFreeFunc *free_func)
|
|
||||||
{
|
|
||||||
hash_table->free_func = free_func;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_hash_table_resize (GHashTable *hash_table)
|
g_hash_table_resize (GHashTable *hash_table)
|
||||||
{
|
{
|
||||||
@ -371,15 +361,14 @@ g_hash_node_new (gpointer key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_hash_node_destroy (GHashNode *hash_node, GFreeFunc *free_func)
|
g_hash_node_destroy (GHashNode *hash_node)
|
||||||
{
|
{
|
||||||
if (free_func) (*free_func)(hash_node->key);
|
|
||||||
hash_node->next = node_free_list;
|
hash_node->next = node_free_list;
|
||||||
node_free_list = hash_node;
|
node_free_list = hash_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_hash_nodes_destroy (GHashNode *hash_node, GFreeFunc *free_func)
|
g_hash_nodes_destroy (GHashNode *hash_node)
|
||||||
{
|
{
|
||||||
GHashNode *node;
|
GHashNode *node;
|
||||||
|
|
||||||
@ -389,10 +378,7 @@ g_hash_nodes_destroy (GHashNode *hash_node, GFreeFunc *free_func)
|
|||||||
node = hash_node;
|
node = hash_node;
|
||||||
|
|
||||||
while (node->next)
|
while (node->next)
|
||||||
{
|
|
||||||
if (free_func) (*free_func)(node->key);
|
|
||||||
node = node->next;
|
node = node->next;
|
||||||
}
|
|
||||||
|
|
||||||
node->next = node_free_list;
|
node->next = node_free_list;
|
||||||
node_free_list = hash_node;
|
node_free_list = hash_node;
|
||||||
|
2
glib.h
2
glib.h
@ -960,8 +960,6 @@ gint g_hash_table_foreach_remove (GHashTable *hash_table,
|
|||||||
GHRFunc func,
|
GHRFunc func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
gint g_hash_table_size (GHashTable *hash_table);
|
gint g_hash_table_size (GHashTable *hash_table);
|
||||||
void g_hash_table_set_key_freefunc (GHashTable *hash_table,
|
|
||||||
GFreeFunc *free_func);
|
|
||||||
|
|
||||||
|
|
||||||
/* Caches
|
/* Caches
|
||||||
|
30
glib/ghash.c
30
glib/ghash.c
@ -40,7 +40,6 @@ struct _GHashTable
|
|||||||
GHashNode **nodes;
|
GHashNode **nodes;
|
||||||
GHashFunc hash_func;
|
GHashFunc hash_func;
|
||||||
GCompareFunc key_compare_func;
|
GCompareFunc key_compare_func;
|
||||||
GFreeFunc *free_func;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -49,10 +48,8 @@ static GHashNode** g_hash_table_lookup_node (GHashTable *hash_table,
|
|||||||
gconstpointer key);
|
gconstpointer key);
|
||||||
static GHashNode* g_hash_node_new (gpointer key,
|
static GHashNode* g_hash_node_new (gpointer key,
|
||||||
gpointer value);
|
gpointer value);
|
||||||
static void g_hash_node_destroy (GHashNode *hash_node,
|
static void g_hash_node_destroy (GHashNode *hash_node);
|
||||||
GFreeFunc *free_func);
|
static void g_hash_nodes_destroy (GHashNode *hash_node);
|
||||||
static void g_hash_nodes_destroy (GHashNode *hash_node,
|
|
||||||
GFreeFunc *free_func);
|
|
||||||
|
|
||||||
|
|
||||||
static GMemChunk *node_mem_chunk = NULL;
|
static GMemChunk *node_mem_chunk = NULL;
|
||||||
@ -73,7 +70,6 @@ g_hash_table_new (GHashFunc hash_func,
|
|||||||
hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
|
hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
|
||||||
hash_table->key_compare_func = key_compare_func;
|
hash_table->key_compare_func = key_compare_func;
|
||||||
hash_table->nodes = g_new (GHashNode*, hash_table->size);
|
hash_table->nodes = g_new (GHashNode*, hash_table->size);
|
||||||
hash_table->free_func = NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < hash_table->size; i++)
|
for (i = 0; i < hash_table->size; i++)
|
||||||
hash_table->nodes[i] = NULL;
|
hash_table->nodes[i] = NULL;
|
||||||
@ -89,7 +85,7 @@ g_hash_table_destroy (GHashTable *hash_table)
|
|||||||
g_return_if_fail (hash_table != NULL);
|
g_return_if_fail (hash_table != NULL);
|
||||||
|
|
||||||
for (i = 0; i < hash_table->size; i++)
|
for (i = 0; i < hash_table->size; i++)
|
||||||
g_hash_nodes_destroy (hash_table->nodes[i], hash_table->free_func);
|
g_hash_nodes_destroy (hash_table->nodes[i]);
|
||||||
|
|
||||||
g_free (hash_table->nodes);
|
g_free (hash_table->nodes);
|
||||||
g_free (hash_table);
|
g_free (hash_table);
|
||||||
@ -174,7 +170,7 @@ g_hash_table_remove (GHashTable *hash_table,
|
|||||||
{
|
{
|
||||||
dest = *node;
|
dest = *node;
|
||||||
(*node) = dest->next;
|
(*node) = dest->next;
|
||||||
g_hash_node_destroy (dest, hash_table->free_func);
|
g_hash_node_destroy (dest);
|
||||||
hash_table->nnodes--;
|
hash_table->nnodes--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,13 +249,13 @@ g_hash_table_foreach_remove (GHashTable *hash_table,
|
|||||||
if (prev)
|
if (prev)
|
||||||
{
|
{
|
||||||
prev->next = node->next;
|
prev->next = node->next;
|
||||||
g_hash_node_destroy (node, hash_table->free_func);
|
g_hash_node_destroy (node);
|
||||||
node = prev;
|
node = prev;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hash_table->nodes[i] = node->next;
|
hash_table->nodes[i] = node->next;
|
||||||
g_hash_node_destroy (node, hash_table->free_func);
|
g_hash_node_destroy (node);
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,12 +293,6 @@ g_hash_table_size (GHashTable *hash_table)
|
|||||||
return hash_table->nnodes;
|
return hash_table->nnodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
g_hash_table_set_key_freefunc (GHashTable *hash_table, GFreeFunc *free_func)
|
|
||||||
{
|
|
||||||
hash_table->free_func = free_func;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_hash_table_resize (GHashTable *hash_table)
|
g_hash_table_resize (GHashTable *hash_table)
|
||||||
{
|
{
|
||||||
@ -371,15 +361,14 @@ g_hash_node_new (gpointer key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_hash_node_destroy (GHashNode *hash_node, GFreeFunc *free_func)
|
g_hash_node_destroy (GHashNode *hash_node)
|
||||||
{
|
{
|
||||||
if (free_func) (*free_func)(hash_node->key);
|
|
||||||
hash_node->next = node_free_list;
|
hash_node->next = node_free_list;
|
||||||
node_free_list = hash_node;
|
node_free_list = hash_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_hash_nodes_destroy (GHashNode *hash_node, GFreeFunc *free_func)
|
g_hash_nodes_destroy (GHashNode *hash_node)
|
||||||
{
|
{
|
||||||
GHashNode *node;
|
GHashNode *node;
|
||||||
|
|
||||||
@ -389,10 +378,7 @@ g_hash_nodes_destroy (GHashNode *hash_node, GFreeFunc *free_func)
|
|||||||
node = hash_node;
|
node = hash_node;
|
||||||
|
|
||||||
while (node->next)
|
while (node->next)
|
||||||
{
|
|
||||||
if (free_func) (*free_func)(node->key);
|
|
||||||
node = node->next;
|
node = node->next;
|
||||||
}
|
|
||||||
|
|
||||||
node->next = node_free_list;
|
node->next = node_free_list;
|
||||||
node_free_list = hash_node;
|
node_free_list = hash_node;
|
||||||
|
@ -960,8 +960,6 @@ gint g_hash_table_foreach_remove (GHashTable *hash_table,
|
|||||||
GHRFunc func,
|
GHRFunc func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
gint g_hash_table_size (GHashTable *hash_table);
|
gint g_hash_table_size (GHashTable *hash_table);
|
||||||
void g_hash_table_set_key_freefunc (GHashTable *hash_table,
|
|
||||||
GFreeFunc *free_func);
|
|
||||||
|
|
||||||
|
|
||||||
/* Caches
|
/* Caches
|
||||||
|
Loading…
Reference in New Issue
Block a user