Mercurial > emacs
annotate oldXMenu/XDelAssoc.c @ 76133:995b45abe69d
Remove license text in favour of including copyright.h, as was done in
original X11 source.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sun, 25 Feb 2007 00:10:18 +0000 |
parents | 3d45362f1d38 |
children | fec5e03aaf59 dd7c098af727 |
rev | line source |
---|---|
25858 | 1 /* Copyright Massachusetts Institute of Technology 1985 */ |
74548 | 2 /* Copyright (C) 2001, 2002, 2003, 2004, 2005, |
75348 | 3 2006, 2007 Free Software Foundation, Inc. */ |
25858 | 4 |
76133
995b45abe69d
Remove license text in favour of including copyright.h, as was done in
Glenn Morris <rgm@gnu.org>
parents:
75348
diff
changeset
|
5 #include "copyright.h" |
995b45abe69d
Remove license text in favour of including copyright.h, as was done in
Glenn Morris <rgm@gnu.org>
parents:
75348
diff
changeset
|
6 |
25858 | 7 |
8 #include <X11/Xlib.h> | |
9 #include "X10.h" | |
10 void emacs_remque(); | |
11 struct qelem { | |
12 struct qelem *q_forw; | |
13 struct qelem *q_back; | |
14 char q_data[1]; | |
15 }; | |
16 | |
17 /* | |
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). | |
21 */ | |
22 XDeleteAssoc(dpy, table, x_id) | |
23 register Display *dpy; | |
24 register XAssocTable *table; | |
25 register XID x_id; | |
26 { | |
27 int hash; | |
28 register XAssoc *bucket; | |
29 register XAssoc *Entry; | |
30 | |
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. */ | |
36 Entry = bucket->next; | |
37 | |
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 */ | |
46 /* free the entry. */ | |
47 emacs_remque((struct qelem *)Entry); | |
48 free((char *)Entry); | |
49 return; | |
50 } | |
51 /* Oops, identical XId's on different displays! */ | |
52 continue; | |
53 } | |
54 if (Entry->x_id > x_id) { | |
55 /* We have gone past where it should be. */ | |
56 /* It is apparently not in the table. */ | |
57 return; | |
58 } | |
59 } | |
60 /* It is apparently not in the table. */ | |
61 return; | |
62 } | |
63 | |
52401 | 64 /* arch-tag: 90981a7e-601c-487a-b364-cdf55d6c475b |
65 (do not change this comment) */ |