1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

Explicitly use STAILQ_REMOVE_HEAD() when we know we are removing the head

element to avoid confusing Coverity.  It's now also easier for humans to
parse as well.

Found by:	Coverity Prevent(tm)
CID:		1201
This commit is contained in:
John Baldwin 2006-07-10 19:28:57 +00:00
parent 0bf8969c60
commit 0f8e0c3dd4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=160245

View File

@ -620,9 +620,8 @@ linker_file_unload(linker_file_t file, int flags)
free(file->deps, M_LINKER);
file->deps = NULL;
}
for (cp = STAILQ_FIRST(&file->common); cp;
cp = STAILQ_FIRST(&file->common)) {
STAILQ_REMOVE(&file->common, cp, common_symbol, link);
while ((cp = STAILQ_FIRST(&file->common)) != NULL) {
STAILQ_REMOVE_HEAD(&file->common, link);
free(cp, M_LINKER);
}