Commit | Line | Data |
---|---|---|
bb2109e7 | 1 | /* |
f5ed9d08 KB |
2 | * Copyright (c) 1988, 1989, 1990, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
c65fedcf | 4 | * |
bb2109e7 KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Adam de Boor. | |
c65fedcf | 7 | * |
f15db449 | 8 | * %sccs.include.redist.c% |
c65fedcf | 9 | */ |
bb2109e7 | 10 | |
c65fedcf | 11 | #ifndef lint |
bfdbffbb | 12 | static char sccsid[] = "@(#)lstDeQueue.c 8.2 (Berkeley) %G%"; |
bb2109e7 KB |
13 | #endif /* not lint */ |
14 | ||
15 | /*- | |
16 | * LstDeQueue.c -- | |
17 | * Remove the node and return its datum from the head of the list | |
18 | */ | |
c65fedcf KB |
19 | |
20 | #include "lstInt.h" | |
21 | ||
22 | /*- | |
23 | *----------------------------------------------------------------------- | |
24 | * Lst_DeQueue -- | |
25 | * Remove and return the datum at the head of the given list. | |
26 | * | |
27 | * Results: | |
28 | * The datum in the node at the head or (ick) NIL if the list | |
29 | * is empty. | |
30 | * | |
31 | * Side Effects: | |
32 | * The head node is removed from the list. | |
33 | * | |
34 | *----------------------------------------------------------------------- | |
35 | */ | |
36 | ClientData | |
37 | Lst_DeQueue (l) | |
38 | Lst l; | |
39 | { | |
40 | ClientData rd; | |
41 | register ListNode tln; | |
42 | ||
43 | tln = (ListNode) Lst_First (l); | |
44 | if (tln == NilListNode) { | |
45 | return ((ClientData) NIL); | |
46 | } | |
47 | ||
48 | rd = tln->datum; | |
49 | if (Lst_Remove (l, (LstNode)tln) == FAILURE) { | |
50 | return ((ClientData) NIL); | |
51 | } else { | |
52 | return (rd); | |
53 | } | |
54 | } | |
55 |