1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
21 Name: common - linked list functions
25 Desc: macros for linked list functions
29 *********************************************************************21*/
35 /* cm_llist_h_001.main_8 */
36 #define cmLListFirst(l) ((l)->crnt = (l)->first)
37 #define cmLListLast(l) ((l)->crnt = (l)->last)
38 #define cmLListCrnt(l) ((l)->crnt)
39 #define cmLListNext(l) ((l)->crnt = ((l)->crnt ? (l)->crnt->next : \
41 #define cmLListPrev(l) ((l)->crnt = ((l)->crnt ? (l)->crnt->prev : \
43 #define cmLListLen(l) ((l)->count)
44 #define cmLListNode(n) ((n)->node)
46 /* cm_llist_h_001.main_9 : added explicit check for warning fix */
48 #define CM_LLIST_FIRST_NODE(l, n) ((((n) = cmLListFirst(l)) != NULLP) ? (n)->node : NULLP)
49 #define CM_LLIST_NEXT_NODE(l, n) ((((n) = cmLListNext(l))!= NULLP) ? (n)->node : NULLP)
50 #define CM_LLIST_PREV_NODE(l, n) ((((n) = cmLListPrev(l)) != NULLP) ? (n)->node : NULLP)
52 #define CM_LLIST_FIRST_NODE(l, n) ((n) = cmLListFirst(l))
53 #define CM_LLIST_NEXT_NODE(l, n) ((n) = cmLListNext(l))
54 #define CM_LLIST_PREV_NODE(l, n) ((n) = cmLListPrev(l))
57 #endif /* __CMLLISTH__ */
60 /********************************************************************30**
63 **********************************************************************/