1/* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003, 2 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 3 4This program is free software; you can redistribute it and/or modify 5it under the terms of the GNU General Public License as published by 6the Free Software Foundation; either version 2, or (at your option) 7any later version. 8 9This program is distributed in the hope that it will be useful, 10but WITHOUT ANY WARRANTY; without even the implied warranty of 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12GNU General Public License for more details. 13 14You should have received a copy of the GNU General Public License 15along with this program; see the file COPYING. If not, write to 16the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17Boston, 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 25struct 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 33void 34emacs_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 47emacs_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) */ 60