131a9abe6Sbostic /* 2d19a14ecSbostic * Copyright (c) 1988, 1989, 1990, 1993 3d19a14ecSbostic * The Regents of the University of California. All rights reserved. 431a9abe6Sbostic * 531a9abe6Sbostic * This code is derived from software contributed to Berkeley by 631a9abe6Sbostic * Adam de Boor. 731a9abe6Sbostic * 82b713f00Sbostic * %sccs.include.redist.c% 931a9abe6Sbostic */ 1031a9abe6Sbostic 1131a9abe6Sbostic #ifndef lint 12*2bb4d294Schristos static char sccsid[] = "@(#)lstDeQueue.c 8.2 (Berkeley) 04/28/95"; 1331a9abe6Sbostic #endif /* not lint */ 1431a9abe6Sbostic 1586d9cf80Sbostic /*- 1686d9cf80Sbostic * LstDeQueue.c -- 1786d9cf80Sbostic * Remove the node and return its datum from the head of the list 1886d9cf80Sbostic */ 1986d9cf80Sbostic 2086d9cf80Sbostic #include "lstInt.h" 2186d9cf80Sbostic 2286d9cf80Sbostic /*- 2386d9cf80Sbostic *----------------------------------------------------------------------- 2486d9cf80Sbostic * Lst_DeQueue -- 2586d9cf80Sbostic * Remove and return the datum at the head of the given list. 2686d9cf80Sbostic * 2786d9cf80Sbostic * Results: 2886d9cf80Sbostic * The datum in the node at the head or (ick) NIL if the list 2986d9cf80Sbostic * is empty. 3086d9cf80Sbostic * 3186d9cf80Sbostic * Side Effects: 3286d9cf80Sbostic * The head node is removed from the list. 3386d9cf80Sbostic * 3486d9cf80Sbostic *----------------------------------------------------------------------- 3586d9cf80Sbostic */ 3686d9cf80Sbostic ClientData Lst_DeQueue(l)3786d9cf80SbosticLst_DeQueue (l) 3886d9cf80Sbostic Lst l; 3986d9cf80Sbostic { 4086d9cf80Sbostic ClientData rd; 4186d9cf80Sbostic register ListNode tln; 4286d9cf80Sbostic 4386d9cf80Sbostic tln = (ListNode) Lst_First (l); 4486d9cf80Sbostic if (tln == NilListNode) { 4586d9cf80Sbostic return ((ClientData) NIL); 4686d9cf80Sbostic } 4786d9cf80Sbostic 4886d9cf80Sbostic rd = tln->datum; 4986d9cf80Sbostic if (Lst_Remove (l, (LstNode)tln) == FAILURE) { 5086d9cf80Sbostic return ((ClientData) NIL); 5186d9cf80Sbostic } else { 5286d9cf80Sbostic return (rd); 5386d9cf80Sbostic } 5486d9cf80Sbostic } 5586d9cf80Sbostic 56