1 |
/* |
2 |
* Hydra, an http server |
3 |
* Copyright (C) 1995 Paul Phillips <paulp@go2net.com> |
4 |
* Some changes Copyright (C) 1997 Jon Nelson <jnelson@boa.org> |
5 |
* |
6 |
* This was moved to macros by Nikos Mavroyanopoulos |
7 |
* |
8 |
* This program is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License as published by |
10 |
* the Free Software Foundation; either version 1, or (at your option) |
11 |
* any later version. |
12 |
* |
13 |
* This program is distributed in the hope that it will be useful, |
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
* GNU General Public License for more details. |
17 |
* |
18 |
* You should have received a copy of the GNU General Public License |
19 |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 |
* |
22 |
*/ |
23 |
|
24 |
/* Templates for Queue functions |
25 |
*/ |
26 |
|
27 |
#define DEQUEUE_FUNCTION( func_name, type) \ |
28 |
void func_name(type ** head, type * req) \ |
29 |
{ \ |
30 |
if (*head == req) \ |
31 |
*head = req->next; \ |
32 |
if (req->prev) \ |
33 |
req->prev->next = req->next; \ |
34 |
if (req->next) \ |
35 |
req->next->prev = req->prev; \ |
36 |
req->next = NULL; \ |
37 |
req->prev = NULL; \ |
38 |
} |
39 |
|
40 |
#define ENQUEUE_FUNCTION( func_name, type) \ |
41 |
void func_name(type ** head, type * req) \ |
42 |
{ \ |
43 |
if (*head) \ |
44 |
(*head)->prev = req; /* previous head's prev is us */ \ |
45 |
req->next = *head; /* our next is previous head */ \ |
46 |
req->prev = NULL; /* first in list */ \ |
47 |
*head = req; /* now we are head */ \ |
48 |
} |
49 |
|