56 lines
1.4 KiB
C
56 lines
1.4 KiB
C
/*-
|
|
* LstDeQueue.c --
|
|
* Remove the node and return its datum from the head of the list
|
|
*
|
|
* Copyright (c) 1988 by University of California Regents
|
|
*
|
|
* Permission to use, copy, modify, and distribute this
|
|
* software and its documentation for any purpose and without
|
|
* fee is hereby granted, provided that the above copyright
|
|
* notice appears in all copies. Neither the University of California nor
|
|
* Adam de Boor makes any representations about the suitability of this
|
|
* software for any purpose. It is provided "as is" without
|
|
* express or implied warranty.
|
|
*/
|
|
#if !defined(lint) && defined(keep_rcsid)
|
|
static char *rcsid =
|
|
"Id: lstDeQueue.c,v 1.5 88/11/17 20:52:11 adam Exp $ SPRITE (Berkeley)";
|
|
#endif lint
|
|
|
|
#include "lstInt.h"
|
|
|
|
/*-
|
|
*-----------------------------------------------------------------------
|
|
* Lst_DeQueue --
|
|
* Remove and return the datum at the head of the given list.
|
|
*
|
|
* Results:
|
|
* The datum in the node at the head or (ick) NIL if the list
|
|
* is empty.
|
|
*
|
|
* Side Effects:
|
|
* The head node is removed from the list.
|
|
*
|
|
*-----------------------------------------------------------------------
|
|
*/
|
|
ClientData
|
|
Lst_DeQueue (l)
|
|
Lst l;
|
|
{
|
|
ClientData rd;
|
|
register ListNode tln;
|
|
|
|
tln = (ListNode) Lst_First (l);
|
|
if (tln == NilListNode) {
|
|
return ((ClientData) NIL);
|
|
}
|
|
|
|
rd = tln->datum;
|
|
if (Lst_Remove (l, (LstNode)tln) == FAILURE) {
|
|
return ((ClientData) NIL);
|
|
} else {
|
|
return (rd);
|
|
}
|
|
}
|
|
|