Make Hash_FlushTable loop safe and correct the copyright notices

This commit is contained in:
Bill Currie 2001-06-19 02:01:18 +00:00
parent 89fecd7cee
commit 3a94567913
2 changed files with 6 additions and 6 deletions

View file

@ -3,8 +3,7 @@
hash tables hash tables
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 2000 Bill Currie <bill@taniwha.org>
Copyright (C) 2000 Marcus Sundberg <mackan@stacken.kth.se>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View file

@ -3,8 +3,7 @@
hash tables hash tables
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 2000 Bill Currie <bill@taniwha.org>
Copyright (C) 2000 Marcus Sundberg <mackan@stacken.kth.se>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -115,10 +114,12 @@ Hash_FlushTable (hashtab_t *tab)
for (i = 0; i < tab->tab_size; i++) { for (i = 0; i < tab->tab_size; i++) {
while (tab->tab[i]) { while (tab->tab[i]) {
struct hashlink_s *t = tab->tab[i]->next; struct hashlink_s *t = tab->tab[i]->next;
if (tab->free_ele) void *data = tab->tab[i]->data;
tab->free_ele (tab->tab[i]->data, tab->user_data);
free (tab->tab[i]); free (tab->tab[i]);
tab->tab[i] = t; tab->tab[i] = t;
if (tab->free_ele)
tab->free_ele (data, tab->user_data);
} }
} }
} }