Adding new commiter to ODU-High repo
[o-du/l2.git] / src / cm / cm_llist.h
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18 \f
19 /********************************************************************20**
20   
21      Name:     common - linked list functions
22   
23      Type:     C include file
24   
25      Desc:     macros for linked list functions
26  
27      File:     cm_llist.h
28  
29 *********************************************************************21*/
30   
31 #ifndef __CMLLISTH__
32 #define __CMLLISTH__
33
34 \f
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 : \
40                                        (l)->first))
41 #define cmLListPrev(l)   ((l)->crnt = ((l)->crnt ? (l)->crnt->prev : \
42                                        (l)->first))
43 #define cmLListLen(l)    ((l)->count)
44 #define cmLListNode(n)   ((n)->node)
45
46 /* cm_llist_h_001.main_9 : added explicit check for warning fix */
47 #ifndef __cplusplus
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)
51 #else
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))
55 #endif
56
57 #endif /* __CMLLISTH__ */
58
59 \f 
60 /********************************************************************30**
61   
62          End of file
63 **********************************************************************/