don't check when its clang masquerading as gcc
[AROS.git] / workbench / fs / pipe / pipelists.c
bloba432e94926271eca71b6b550f0574e87963501b4
1 /****************************************************************************
2 ** File: pipelists.c
3 ** Program: pipe-handler - an AmigaDOS handler for named pipes
4 ** Version: 1.1
5 ** Author: Ed Puckett qix@mit-oz
6 **
7 ** Copyright 1987 by EpAc Software. All Rights Reserved.
8 **
9 ** History: 05-Jan-87 Original Version (1.0)
12 #include <exec/types.h>
14 #include "pipelists.h"
18 /*---------------------------------------------------------------------------
19 ** pipelists.c
20 ** -----------
21 ** This module contains functions and macros for list manipulation.
22 ** To use its functions, a PIPELISTNODE must be part of the structure to be
23 ** inserted in a list. A list is identified by a PIPELISTHEADER (not a
24 ** pointer to, but an actual PIPELISTHEADER structure).
25 ** These routines, as implemented, use the fact that a PIPELISTHEADER
26 ** and a PIPELISTNODE have the same struture. Loops are started with the
27 ** scanning pointer referencing the header. This makes processing uniform,
28 ** even when the list is empty.
30 ** Visible Functions
31 ** -----------------
32 ** void InsertHead (headerp, nodep)
33 ** void InsertTail (headerp, nodep)
34 ** void Delete (headerp, nodep)
36 ** Macros (in pipelists.h)
37 ** -----------------------
38 ** InitList (headerp)
39 ** FirstItem (headerp)
40 ** NextItem (nodep)
42 ** Local Functions
43 ** ---------------
44 ** - none -
49 /*---------------------------------------------------------------------------
50 ** Insert the node pointed to by "nodep" at the head (front) of the list
51 ** identified by "headerp".
54 void InsertHead (headerp, nodep)
56 PIPELISTHEADER *headerp;
57 PIPELISTNODE *nodep;
59 { nodep->next= headerp->head;
60 headerp->head= nodep;
65 /*---------------------------------------------------------------------------
66 ** Insert the node pointed to by "nodep" at the tail (end) of the list
67 ** identified by "headerp".
70 void InsertTail (headerp, nodep)
72 PIPELISTHEADER *headerp;
73 PIPELISTNODE *nodep;
75 { register PIPELISTNODE *l;
78 for (l= (PIPELISTNODE *) headerp; l->next != NULL; l= l->next)
81 l->next= nodep;
82 nodep->next= NULL;
87 /*---------------------------------------------------------------------------
88 ** Delete the node pointed to by "nodep" from the list identified by
89 ** "headerp". If the node is not found in the list, nothing is done.
92 void Delete (headerp, nodep)
94 PIPELISTHEADER *headerp;
95 PIPELISTNODE *nodep;
97 { PIPELISTNODE *l;
100 for (l= (PIPELISTNODE *) headerp; l->next != NULL; l= l->next)
101 if (l->next == nodep)
102 { l->next= l->next->next;
103 break;