| 1 | /* Copyright Massachusetts Institute of Technology 1985 */ |
| 2 | |
| 3 | #include "copyright.h" |
| 4 | |
| 5 | #include "XMenuInt.h" |
| 6 | |
| 7 | /* |
| 8 | * XDestroyAssocTable - Destroy (free the memory associated with) |
| 9 | * an XAssocTable. |
| 10 | */ |
| 11 | void |
| 12 | XDestroyAssocTable(register XAssocTable *table) |
| 13 | { |
| 14 | register int i; |
| 15 | register XAssoc *bucket; |
| 16 | register XAssoc *Entry, *entry_next; |
| 17 | |
| 18 | /* Free the buckets. */ |
| 19 | for (i = 0; i < table->size; i++) { |
| 20 | bucket = &table->buckets[i]; |
| 21 | for ( |
| 22 | Entry = bucket->next; |
| 23 | Entry != bucket; |
| 24 | Entry = entry_next |
| 25 | ) { |
| 26 | entry_next = Entry->next; |
| 27 | free((char *)Entry); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | /* Free the bucket array. */ |
| 32 | free((char *)table->buckets); |
| 33 | |
| 34 | /* Free the table. */ |
| 35 | free((char *)table); |
| 36 | } |