xref: /reactos/base/setup/lib/utils/linklist.h (revision cc439606)
1 /*
2  * PROJECT:     ReactOS Setup Library
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Linked list support macros
5  * COPYRIGHT:   Copyright 2005-2018 ReactOS Team
6  */
7 
8 #pragma once
9 
10 #define InsertAscendingList(ListHead, NewEntry, Type, ListEntryField, SortField) \
11 do { \
12     PLIST_ENTRY current = (ListHead)->Flink; \
13     while (current != (ListHead)) \
14     { \
15         if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >= \
16             (NewEntry)->SortField) \
17         { \
18             break; \
19         } \
20         current = current->Flink; \
21     } \
22 \
23     InsertTailList(current, &((NewEntry)->ListEntryField)); \
24 } while (0)
25 
26 /* EOF */
27