1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XDeleteAssoc.c,v 10.4 86/02/01 15:31:59 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: #include "XlibInternal.h"
   7: 
   8: /*
   9:  * XDeleteAssoc - Delete an association in an XAssocTable keyed on
  10:  * an XId.  An association may be removed only once.  Redundant
  11:  * deletes are meaningless (but cause no problems).
  12:  */
  13: XDeleteAssoc(table, x_id)
  14:     register XAssocTable *table;
  15:     register XId x_id;
  16: {
  17:     int hash;
  18:     register XAssoc *bucket;
  19:     register XAssoc *entry;
  20: 
  21:     /* Hash the XId to get the bucket number. */
  22:     hash = x_id & (table->size - 1);
  23:     /* Look up the bucket to get the entries in that bucket. */
  24:     bucket = &(*table->table)[hash];
  25:     /* Get the first entry in the bucket. */
  26:     entry = bucket->next;
  27: 
  28:     /* Scan through the entries in the bucket for the right XId. */
  29:     for (entry; entry != bucket; entry = entry->next) {
  30:         if (entry->x_id == x_id) {
  31:             /* We have the right XId. */
  32:             if (entry->display == _XlibCurrentDisplay) {
  33:                 /* We have the right display. */
  34:                 /* We have the right entry! */
  35:                 /* Remove it from the queue and */
  36:                 /* free the entry. */
  37:                 remque(entry);
  38:                 free(entry);
  39:                 return;
  40:             }
  41:             /* Oops, identical XId's on different displays! */
  42:             continue;
  43:         }
  44:         if (entry->x_id > x_id) {
  45:             /* We have gone past where it should be. */
  46:             /* It is apparently not in the table. */
  47:             return;
  48:         }
  49:     }
  50:     /* It is apparently not in the table. */
  51:     return;
  52: }

Defined functions

Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 693
Valid CSS Valid XHTML 1.0 Strict