1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Remove Lst_Find() and Lst_FindFrom() now that they aren't needed anymore.

This commit is contained in:
Hartmut Brandt 2005-03-22 12:40:24 +00:00
parent e4a90d00b4
commit ad6ba6872a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143976
2 changed files with 8 additions and 48 deletions

View File

@ -268,49 +268,6 @@ Lst_Duplicate(Lst *dst, Lst *src, DuplicateProc *copyProc)
}
}
/*-
*-----------------------------------------------------------------------
* Lst_FindFrom --
* Search for a node starting and ending with the given one on the
* given list using the passed datum and comparison function to
* determine when it has been found.
*
* Results:
* The found node or NULL
*
* Side Effects:
* None.
*
*-----------------------------------------------------------------------
*/
LstNode *
Lst_FindFrom(Lst *l, LstNode *ln, const void *d, CompareProc *cProc)
{
LstNode *tln;
Boolean found = FALSE;
if (!Lst_Valid(l) || Lst_IsEmpty(l) || !Lst_NodeValid(ln, l)) {
return (NULL);
}
tln = ln;
do {
if ((*cProc)(tln->datum, d) == 0) {
found = TRUE;
break;
} else {
tln = tln->nextPtr;
}
} while (tln != ln && tln != NULL);
if (found) {
return (tln);
} else {
return (NULL);
}
}
/*-
*-----------------------------------------------------------------------
* Lst_Insert --

View File

@ -69,7 +69,6 @@ struct Lst {
};
typedef struct Lst Lst;
typedef int CompareProc(const void *, const void *);
typedef void *DuplicateProc(void *);
typedef void FreeProc(void *);
@ -137,10 +136,7 @@ void Lst_Concat(Lst *, Lst *, int);
/*
* Functions for entire lists
*/
/* Find an element in a list */
#define Lst_Find(LST, D, FN) (Lst_FindFrom((LST), Lst_First(LST), (D), (FN)))
/* Find an element starting from somewhere */
LstNode *Lst_FindFrom(Lst *, LstNode *, const void *, CompareProc *);
/*
* See if the given datum is on the list. Returns the LstNode containing
* the datum
@ -148,8 +144,15 @@ LstNode *Lst_FindFrom(Lst *, LstNode *, const void *, CompareProc *);
LstNode *Lst_Member(Lst *, void *);
/* Loop through a list. Note, that you may not delete the list element. */
/*
#define LST_FOREACH(PTR, LST) \
for ((PTR) = (LST)->firstPtr; (PTR) != NULL; (PTR) = (PTR)->nextPtr)
*/
#define LST_FOREACH(PTR, LST) \
for (LstNode *_tmp1 = (LST)->firstPtr, *_tmp2 = Lst_Succ(_tmp1);\
((PTR) = _tmp1) != NULL; \
(Lst_Succ(_tmp1) != _tmp2 ? abort() : (void)0), \
(_tmp1 = _tmp2), _tmp2 = Lst_Succ(_tmp1))
/*
* for using the list as a queue