Page MenuHomeFreeBSD

queue.h: Define {LIST,TAILQ}_REMOVE_HEAD
ClosedPublic

Authored by cperciva on Jul 19 2023, 12:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 14, 2:46 PM
Unknown Object (File)
Tue, Mar 10, 4:03 PM
Unknown Object (File)
Tue, Mar 10, 10:14 AM
Unknown Object (File)
Tue, Mar 10, 6:52 AM
Unknown Object (File)
Tue, Mar 3, 3:05 PM
Unknown Object (File)
Mon, Mar 2, 4:56 AM
Unknown Object (File)
Feb 8 2026, 1:46 AM
Unknown Object (File)
Feb 7 2026, 10:09 PM
Subscribers

Details

Summary

The LIST and TAILQ structures have fast _REMOVE macros (since each
element has a pointer to the previous element); we implement the
_REMOVE_HEAD macros for them by simply finding the first element and
then removing it.

Sponsored by: https://www.patreon.com/cperciva

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 52696
Build 49587: arc lint + arc unit

Event Timeline

I wonder why these were never implemented before.
FWIW I found one LIST_REMOVE(LIST_FIRST... in the tree, in sys/dev/neta/if_mvneta.c

I wonder why these were never implemented before.

Probably because _REMOVE was considered the "first class citizen" and _REMOVE_HEAD was only provided as an alternative for list types which didn't have _REMOVE.

FWIW I found one LIST_REMOVE(LIST_FIRST... in the tree, in sys/dev/neta/if_mvneta.c

We can change that later. :-)

This revision is now accepted and ready to land.Jul 19 2023, 5:30 PM
This revision was automatically updated to reflect the committed changes.