]>
code.delx.au - gnu-emacs/blob - oldXMenu/XDelAssoc.c
1 /* Copyright Massachusetts Institute of Technology 1985 */
2 /* Copyright (C) 2001, 2002, 2003, 2004, 2005,
3 2006, 2007 Free Software Foundation, Inc. */
18 * XDeleteAssoc - Delete an association in an XAssocTable keyed on
19 * an XId. An association may be removed only once. Redundant
20 * deletes are meaningless (but cause no problems).
22 XDeleteAssoc(dpy
, table
, x_id
)
23 register Display
*dpy
;
24 register XAssocTable
*table
;
28 register XAssoc
*bucket
;
29 register XAssoc
*Entry
;
31 /* Hash the XId to get the bucket number. */
32 hash
= x_id
& (table
->size
- 1);
33 /* Look up the bucket to get the entries in that bucket. */
34 bucket
= &table
->buckets
[hash
];
35 /* Get the first entry in the bucket. */
38 /* Scan through the entries in the bucket for the right XId. */
39 for (; Entry
!= bucket
; Entry
= Entry
->next
) {
40 if (Entry
->x_id
== x_id
) {
41 /* We have the right XId. */
42 if (Entry
->display
== dpy
) {
43 /* We have the right display. */
44 /* We have the right entry! */
45 /* Remove it from the queue and */
47 emacs_remque((struct qelem
*)Entry
);
51 /* Oops, identical XId's on different displays! */
54 if (Entry
->x_id
> x_id
) {
55 /* We have gone past where it should be. */
56 /* It is apparently not in the table. */
60 /* It is apparently not in the table. */
64 /* arch-tag: 90981a7e-601c-487a-b364-cdf55d6c475b
65 (do not change this comment) */