Commit | Line | Data |
---|---|---|
e745ede7 DL |
1 | /* Copyright Massachusetts Institute of Technology 1985 */ |
2 | ||
0ff3f435 GM |
3 | #include "copyright.h" |
4 | ||
55660072 | 5 | #include "XMenuInt.h" |
e745ede7 DL |
6 | |
7 | /* | |
8 | * XDestroyAssocTable - Destroy (free the memory associated with) | |
177c0ea7 | 9 | * an XAssocTable. |
e745ede7 | 10 | */ |
55660072 | 11 | void |
b782e2d7 | 12 | XDestroyAssocTable(register XAssocTable *table) |
e745ede7 DL |
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 | } |