diff mbox series

[21/22] list.3: BUGS: Note LIST_FOREACH() limitations

Message ID 20201020142146.61837-22-colomar.6.4.3@gmail.com
State Not Applicable
Headers show
Series list.3: New page forked from queue.3 | expand

Commit Message

Alejandro Colomar Oct. 20, 2020, 2:21 p.m. UTC
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
---
 man3/list.3 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/man3/list.3 b/man3/list.3
index bb64fff92..4aec14cc8 100644
--- a/man3/list.3
+++ b/man3/list.3
@@ -261,6 +261,20 @@  Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008.
 Present on the BSDs
 (LIST macros first appeared in 4.4BSD).
 .SH BUGS
+The macro
+.BR LIST_FOREACH ()
+doesn't allow
+.I var
+to be removed or freed within the loop,
+as it would interfere with the traversal.
+The macro
+.BR LIST_FOREACH_SAFE (),
+which is not present in glibc,
+solves this bug by
+allowing to both remove
+.I var
+as well as free it from within the loop safely
+without interfering with the traversal.
 .SH EXAMPLES
 .EX
 #include <stddef.h>