1 /* Copyright Massachusetts Institute of Technology 1985 */
8 * XDeleteAssoc - Delete an association in an XAssocTable keyed on
9 * an XId. An association may be removed only once. Redundant
10 * deletes are meaningless (but cause no problems).
13 XDeleteAssoc(register Display
*dpy
, register XAssocTable
*table
, register XID x_id
)
16 register XAssoc
*bucket
;
17 register XAssoc
*Entry
;
19 /* Hash the XId to get the bucket number. */
20 hash
= x_id
& (table
->size
- 1);
21 /* Look up the bucket to get the entries in that bucket. */
22 bucket
= &table
->buckets
[hash
];
23 /* Get the first entry in the bucket. */
26 /* Scan through the entries in the bucket for the right XId. */
27 for (; Entry
!= bucket
; Entry
= Entry
->next
) {
28 if (Entry
->x_id
== x_id
) {
29 /* We have the right XId. */
30 if (Entry
->display
== dpy
) {
31 /* We have the right display. */
32 /* We have the right entry! */
33 /* Remove it from the queue and */
35 emacs_remque((struct qelem
*)Entry
);
39 /* Oops, identical XId's on different displays! */
42 if (Entry
->x_id
> x_id
) {
43 /* We have gone past where it should be. */
44 /* It is apparently not in the table. */
48 /* It is apparently not in the table. */