root/trunk/oldXMenu/insque.c
| Revision 4220, 1.8 kB (checked in by miyoshi, 9 months ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003, |
| 2 | 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
| 3 | |
| 4 | This program is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by |
| 6 | the Free Software Foundation; either version 3, or (at your option) |
| 7 | any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program; see the file COPYING. If not, write to |
| 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | Boston, MA 02110-1301, USA. */ |
| 18 | |
| 19 | /* This file implements the emacs_insque and emacs_remque functions, |
| 20 | clones of the insque and remque functions of BSD. They and all |
| 21 | their callers have been renamed to emacs_mumble to allow us to |
| 22 | include this file in the menu library on all systems. */ |
| 23 | |
| 24 | |
| 25 | struct qelem { |
| 26 | struct qelem *q_forw; |
| 27 | struct qelem *q_back; |
| 28 | char q_data[1]; |
| 29 | }; |
| 30 | |
| 31 | /* Insert ELEM into a doubly-linked list, after PREV. */ |
| 32 | |
| 33 | void |
| 34 | emacs_insque (elem, prev) |
| 35 | struct qelem *elem, *prev; |
| 36 | { |
| 37 | struct qelem *next = prev->q_forw; |
| 38 | prev->q_forw = elem; |
| 39 | if (next) |
| 40 | next->q_back = elem; |
| 41 | elem->q_forw = next; |
| 42 | elem->q_back = prev; |
| 43 | } |
| 44 | |
| 45 | /* Unlink ELEM from the doubly-linked list that it is in. */ |
| 46 | |
| 47 | emacs_remque (elem) |
| 48 | struct qelem *elem; |
| 49 | { |
| 50 | struct qelem *next = elem->q_forw; |
| 51 | struct qelem *prev = elem->q_back; |
| 52 | if (next) |
| 53 | next->q_back = prev; |
| 54 | if (prev) |
| 55 | prev->q_forw = next; |
| 56 | } |
| 57 | |
| 58 | /* arch-tag: a8719d1a-5c3f-4bce-b36b-173106d36165 |
| 59 | (do not change this comment) */ |
Note: See TracBrowser for help on using the browser.
