1 /*- 2 * LstDeQueue.c -- 3 * Remove the node and return its datum from the head of the list 4 * 5 * Copyright (c) 1988 by University of California Regents 6 * 7 * Permission to use, copy, modify, and distribute this 8 * software and its documentation for any purpose and without 9 * fee is hereby granted, provided that the above copyright 10 * notice appears in all copies. Neither the University of California nor 11 * Adam de Boor makes any representations about the suitability of this 12 * software for any purpose. It is provided "as is" without 13 * express or implied warranty. 14 */ 15 #ifndef lint 16 static char *rcsid = 17 "$Id: lstDeQueue.c,v 1.5 88/11/17 20:52:11 adam Exp $ SPRITE (Berkeley)"; 18 #endif lint 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 56