1 /* Copyright Massachusetts Institute of Technology 1985 */
2
3 /*
4
5 Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology
6
7 Permission to use, copy, modify, and distribute this
8 software and its documentation for any purpose and without
9 fee is hereby granted, provided that the above copyright
10 notice appear in all copies and that both that copyright
11 notice and this permission notice appear in supporting
12 documentation, and that the name of M.I.T. not be used in
13 advertising or publicity pertaining to distribution of the
14 software without specific, written prior permission.
15 M.I.T. makes no representations about the suitability of
16 this software for any purpose. It is provided "as is"
17 without express or implied warranty.
18
19 */
20
21
22
23 #include "XMenuInt.h"
24
25 /*
26 * XDestroyAssocTable - Destroy (free the memory associated with)
27 * an XAssocTable.
28 */
29 void
30 XDestroyAssocTable(register XAssocTable *table)
31 {
32 register int i;
33 register XAssoc *bucket;
34 register XAssoc *Entry, *entry_next;
35
36 /* Free the buckets. */
37 for (i = 0; i < table->size; i++) {
38 bucket = &table->buckets[i];
39 for (
40 Entry = bucket->next;
41 Entry != bucket;
42 Entry = entry_next
43 ) {
44 entry_next = Entry->next;
45 free((char *)Entry);
46 }
47 }
48
49 /* Free the bucket array. */
50 free((char *)table->buckets);
51
52 /* Free the table. */
53 free((char *)table);
54 }