| 1 | /*- |
| 2 | * LstIsEmpty.c -- |
| 3 | * A single function to decide if a list is empty |
| 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: lstIsEmpty.c,v 1.5 88/11/17 20:53:19 adam Exp $ SPRITE (Berkeley)"; |
| 18 | #endif lint |
| 19 | |
| 20 | #include "lstInt.h" |
| 21 | |
| 22 | /*- |
| 23 | *----------------------------------------------------------------------- |
| 24 | * Lst_IsEmpty -- |
| 25 | * Return TRUE if the given list is empty. |
| 26 | * |
| 27 | * Results: |
| 28 | * TRUE if the list is empty, FALSE otherwise. |
| 29 | * |
| 30 | * Side Effects: |
| 31 | * None. |
| 32 | * |
| 33 | * A list is considered empty if its firstPtr == NilListNode (or if |
| 34 | * the list itself is NILLIST). |
| 35 | *----------------------------------------------------------------------- |
| 36 | */ |
| 37 | Boolean |
| 38 | Lst_IsEmpty (l) |
| 39 | Lst l; |
| 40 | { |
| 41 | return ( ! LstValid (l) || LstIsEmpty(l)); |
| 42 | } |
| 43 | |