* lib-src/b2m.c (main): Don't include <limits.h>.
[emacs.git] / oldXMenu / insque.c
blobfef750484a3ff098d096ddfdcac2b53e815cfc52
1 /* Copyright (C) 2002, 2003, 2004, 2005,
2 2006 Free Software Foundation, Inc. */
4 /* This file implements the emacs_insque and emacs_remque functions,
5 copies of the insque and remque functions of BSD. They and all
6 their callers have been renamed to emacs_mumble to allow us to
7 include this file in the menu library on all systems. */
10 struct qelem {
11 struct qelem *q_forw;
12 struct qelem *q_back;
13 char q_data[1];
16 /* Insert ELEM into a doubly-linked list, after PREV. */
18 void
19 emacs_insque (elem, prev)
20 struct qelem *elem, *prev;
22 struct qelem *next = prev->q_forw;
23 prev->q_forw = elem;
24 if (next)
25 next->q_back = elem;
26 elem->q_forw = next;
27 elem->q_back = prev;
30 /* Unlink ELEM from the doubly-linked list that it is in. */
32 emacs_remque (elem)
33 struct qelem *elem;
35 struct qelem *next = elem->q_forw;
36 struct qelem *prev = elem->q_back;
37 if (next)
38 next->q_back = prev;
39 if (prev)
40 prev->q_forw = next;
43 /* arch-tag: a8719d1a-5c3f-4bce-b36b-173106d36165
44 (do not change this comment) */