The branch main has been updated by avg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5dab06a003189ebb017810bdbf3b3c2f074afd3e

commit 5dab06a003189ebb017810bdbf3b3c2f074afd3e
Author:     Andriy Gapon <[email protected]>
AuthorDate: 2021-12-15 11:27:49 +0000
Commit:     Andriy Gapon <[email protected]>
CommitDate: 2021-12-15 11:28:33 +0000

    sys/queue.h: move trashing from SLIST_REMOVE to REMOVE_AFTER, REMOVE_HEAD
    
    SLIST_REMOVE calls either REMOVE_AFTER or REMOVE_HEAD to do the job.
    But those two macros can be used independently as well.
    
    MFC after:      2 weeks
---
 sys/sys/queue.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/sys/queue.h b/sys/sys/queue.h
index 25091ec815f1..6c7c37308b4d 100644
--- a/sys/sys/queue.h
+++ b/sys/sys/queue.h
@@ -272,7 +272,6 @@ struct {                                                    
        \
 #define        SLIST_NEXT(elm, field)  ((elm)->field.sle_next)
 
 #define        SLIST_REMOVE(head, elm, type, field) do {                       
\
-       QMD_SAVELINK(oldnext, (elm)->field.sle_next);                   \
        if (SLIST_FIRST((head)) == (elm)) {                             \
                SLIST_REMOVE_HEAD((head), field);                       \
        }                                                               \
@@ -282,16 +281,19 @@ struct {                                                  
        \
                        curelm = SLIST_NEXT(curelm, field);             \
                SLIST_REMOVE_AFTER(curelm, field);                      \
        }                                                               \
-       TRASHIT(*oldnext);                                              \
 } while (0)
 
 #define SLIST_REMOVE_AFTER(elm, field) do {                            \
+       QMD_SAVELINK(oldnext, SLIST_NEXT(elm, field)->field.sle_next);  \
        SLIST_NEXT(elm, field) =                                        \
            SLIST_NEXT(SLIST_NEXT(elm, field), field);                  \
+       TRASHIT(*oldnext);                                              \
 } while (0)
 
 #define        SLIST_REMOVE_HEAD(head, field) do {                             
\
+       QMD_SAVELINK(oldnext, SLIST_FIRST(head)->field.sle_next);       \
        SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);   \
+       TRASHIT(*oldnext);                                              \
 } while (0)
 
 #define        SLIST_REMOVE_PREVPTR(prevp, elm, field) do {                    
\

Reply via email to