XDestAssoc.c 807 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* Copyright Massachusetts Institute of Technology 1985 */
  2. #include "copyright.h"
  3. #include <X11/Xlib.h>
  4. #include "X10.h"
  5. /*
  6. * XDestroyAssocTable - Destroy (free the memory associated with)
  7. * an XAssocTable.
  8. */
  9. XDestroyAssocTable(table)
  10. register XAssocTable *table;
  11. {
  12. register int i;
  13. register XAssoc *bucket;
  14. register XAssoc *Entry, *entry_next;
  15. /* Free the buckets. */
  16. for (i = 0; i < table->size; i++) {
  17. bucket = &table->buckets[i];
  18. for (
  19. Entry = bucket->next;
  20. Entry != bucket;
  21. Entry = entry_next
  22. ) {
  23. entry_next = Entry->next;
  24. free((char *)Entry);
  25. }
  26. }
  27. /* Free the bucket array. */
  28. free((char *)table->buckets);
  29. /* Free the table. */
  30. free((char *)table);
  31. }
  32. /* arch-tag: a536bf02-8d63-45f2-8c1a-c7f9fd4da2cf
  33. (do not change this comment) */