diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | window-table.c | 8 |
2 files changed, 9 insertions, 4 deletions
@@ -1,3 +1,8 @@ +2010-11-01 Gary Wong <gtw@gnu.org> + + * window-table.c (table_insert_index, stack_insert): Fix rehashing + bug which could corrupt table sizes. + 2010-06-01 Gary Wong <gtw@gnu.org> * decorate-render.c (query_metrics): Don't try to load metrics diff --git a/window-table.c b/window-table.c index 981d6b1..ccdf80f 100644 --- a/window-table.c +++ b/window-table.c @@ -165,11 +165,11 @@ static void table_rehash( struct window_table *table, unsigned long hash, static void table_insert_index( struct window_table *table, xcb_window_t key, int index ) { - table->used++; - for(;;) { int i; + table->used++; + for( i = 0; i < table->max; i++ ) { int h = table_hash( table->hash, table->n, i & 1, key ); xcb_window_t old_key = table->t[ i & 1 ][ h ].key; @@ -443,11 +443,11 @@ static void stack_insert( struct window_stack *stack, xcb_window_t window, xcb_window_t lower_window, xcb_window_t higher_window ) { - stack->used++; - for(;;) { int i; + stack->used++; + for( i = 0; i < stack->max; i++ ) { int h = table_hash( stack->hash, stack->n, i & 1, window ); xcb_window_t old_window = stack->t[ i & 1 ][ h ].window; |