diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-05 22:47:50 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-05 22:47:50 +0000 |
commit | 69772383135b7682bf02ccf2336b1f51b1b7194f (patch) | |
tree | ff447a8b637d23c9c287f215e5fb2499d22368a2 /src/lwp.c | |
parent | 540272705790811627f15a787d094f5a57f67d92 (diff) |
Fix a couple of severve bugs in maintaining the hash table of LWP_Allocators.
Diffstat (limited to 'src/lwp.c')
-rw-r--r-- | src/lwp.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -419,6 +419,7 @@ _lwp_write_events (const LWP_EventRecord *events, gushort n_events) goto CLEAN_FD; } } + pending_allocators = NULL; /* send all the recent events */ if (! _lwp_writen (fd, &n_events, sizeof (n_events))) @@ -587,7 +588,10 @@ _lwp_allocator_hash (gpointer *ips, guint n_ips) } static gboolean -_lwp_allocator_equal (LWP_Allocator *A, gpointer *ips, guint n_ips, gulong hash) +_lwp_allocator_equal (const LWP_Allocator *A, + gpointer *ips, + guint n_ips, + gulong hash) { guint n; @@ -613,14 +617,11 @@ _lwp_add_allocator (gpointer *ips, guint n_ips) hash = _lwp_allocator_hash (ips, n_ips); index = hash % G_N_ELEMENTS (allocator_ht); - for (A = allocator_ht[index]; A != NULL; A = A->next) { + for (A = allocator_ht[index]; A != NULL; A = A->ht_next) { if (_lwp_allocator_equal (A, ips, n_ips, hash)) - break; + return A->key; } - if (A != NULL) - return A->key; - return _lwp_allocator_alloc (ips, n_ips, hash); } |