(mh-inherit-face-flag): New variable. Non-nil means that the defface
[emacs.git] / oldXMenu / XDelAssoc.c
blob772e9fa1b400fc857df2305bb2ae5819543a105e
1 /* Copyright Massachusetts Institute of Technology 1985 */
2 /* Copyright (C) 2002, 2003, 2004, 2005,
3 2006 Free Software Foundation, Inc. */
5 /*
6 Permission to use, copy, modify, distribute, and sell this software and its
7 documentation for any purpose is hereby granted without fee, provided that
8 the above copyright notice appear in all copies and that both that
9 copyright notice and this permission notice appear in supporting
10 documentation, and that the name of M.I.T. not be used in advertising or
11 publicity pertaining to distribution of the software without specific,
12 written prior permission. M.I.T. makes no representations about the
13 suitability of this software for any purpose. It is provided "as is"
14 without express or implied warranty.
17 #include <X11/Xlib.h>
18 #include "X10.h"
19 void emacs_remque();
20 struct qelem {
21 struct qelem *q_forw;
22 struct qelem *q_back;
23 char q_data[1];
27 * XDeleteAssoc - Delete an association in an XAssocTable keyed on
28 * an XId. An association may be removed only once. Redundant
29 * deletes are meaningless (but cause no problems).
31 XDeleteAssoc(dpy, table, x_id)
32 register Display *dpy;
33 register XAssocTable *table;
34 register XID x_id;
36 int hash;
37 register XAssoc *bucket;
38 register XAssoc *Entry;
40 /* Hash the XId to get the bucket number. */
41 hash = x_id & (table->size - 1);
42 /* Look up the bucket to get the entries in that bucket. */
43 bucket = &table->buckets[hash];
44 /* Get the first entry in the bucket. */
45 Entry = bucket->next;
47 /* Scan through the entries in the bucket for the right XId. */
48 for (; Entry != bucket; Entry = Entry->next) {
49 if (Entry->x_id == x_id) {
50 /* We have the right XId. */
51 if (Entry->display == dpy) {
52 /* We have the right display. */
53 /* We have the right entry! */
54 /* Remove it from the queue and */
55 /* free the entry. */
56 emacs_remque((struct qelem *)Entry);
57 free((char *)Entry);
58 return;
60 /* Oops, identical XId's on different displays! */
61 continue;
63 if (Entry->x_id > x_id) {
64 /* We have gone past where it should be. */
65 /* It is apparently not in the table. */
66 return;
69 /* It is apparently not in the table. */
70 return;
73 /* arch-tag: 90981a7e-601c-487a-b364-cdf55d6c475b
74 (do not change this comment) */