mynewt-core icon indicating copy to clipboard operation
mynewt-core copied to clipboard

update queue.h

Open sdalu opened this issue 6 years ago • 2 comments

The provided version of queue.h seems to be outdated in functionalities compared to the version available in FreeBSD for example: https://github.com/freebsd/freebsd/blob/master/sys/sys/queue.h

Note, that the FreeBSD version doesn't include CIRCLEQ anymore, as TAILQ is the prefered way to go: https://stackoverflow.com/a/32013537

sdalu avatar Apr 10 '19 09:04 sdalu

Apart from having the latest version, are there any obvious advantages in updating (bug fixes or new data-structures) ?

utzig avatar Apr 10 '19 11:04 utzig

Being able to retrieve the previous element of a double linked list (LIST_PREV) is the obvious missing macro from the current queue.h

Other benefits:

  • *_SAFE variants, allowing removal of element during FOREACH
  • new manipulation macros: *_SWAP, *_REMOVE_AFTER, *_CONCAT
  • debugging support

The idea is not to reinvent the wheel for such common operations

sdalu avatar Apr 11 '19 12:04 sdalu