X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fcm_llist.c;h=e8c02510c6ccfdf8433856c04fa15e5753184b24;hb=904a5d446b480d71da1bf81f892bab86ab365ce6;hp=12fb582c3c47c687b8a22e37f5dd8a60c6fe762e;hpb=694adde1a08c393a8443fd5bbd4f036f5cf85403;p=o-du%2Fl2.git diff --git a/src/cm/cm_llist.c b/src/cm/cm_llist.c index 12fb582c3..e8c02510c 100644 --- a/src/cm/cm_llist.c +++ b/src/cm/cm_llist.c @@ -60,15 +60,10 @@ * File: cm_llist.c * */ -#ifdef ANSI Void cmLListInit ( CmLListCp *lCp /* list control point */ ) -#else -Void cmLListInit(lCp) -CmLListCp *lCp; /* list control point */ -#endif { lCp->first = (CmLList *)NULLP; @@ -76,7 +71,7 @@ CmLListCp *lCp; /* list control point */ lCp->crnt = (CmLList *)NULLP; lCp->count = 0; - RETVOID; + return; } /* end of cmLListInit */ @@ -95,22 +90,16 @@ CmLListCp *lCp; /* list control point */ * File: cm_llist.c * */ -#ifdef ANSI Void cmLListAdd2Head ( CmLListCp *lCp, /* list control point */ CmLList *node /* node to be added */ ) -#else -Void cmLListAdd2Head(lCp, node) -CmLListCp *lCp; /* list control point */ -CmLList *node; /* node to be added */ -#endif { #ifdef ERRCHK if (lCp == (CmLListCp *)NULLP) - RETVOID; + return; #endif lCp->count++; @@ -122,11 +111,11 @@ CmLList *node; /* node to be added */ if (!node->next) { lCp->last = node; - RETVOID; + return; } node->next->prev = node; - RETVOID; + return; } /* end of cmLListAdd2Head */ @@ -143,22 +132,16 @@ CmLList *node; /* node to be added */ * File: cm_llist.c * */ -#ifdef ANSI Void cmLListAdd2Tail ( CmLListCp *lCp, /* list control point */ CmLList *node /* node to be added */ ) -#else -Void cmLListAdd2Tail(lCp, node) -CmLListCp *lCp; /* list control point */ -CmLList *node; /* node to be added */ -#endif { #ifdef ERRCHK if (lCp == (CmLListCp *)NULLP) - RETVOID; + return; #endif lCp->count++; @@ -170,11 +153,11 @@ CmLList *node; /* node to be added */ if (!node->prev) { lCp->first = node; - RETVOID; + return; } node->prev->next = node; - RETVOID; + return; } /* end of cmLListAdd2Tail */ @@ -191,22 +174,16 @@ CmLList *node; /* node to be added */ * File: cm_llist.c * */ -#ifdef ANSI Void cmLListInsCrnt ( CmLListCp *lCp, /* list control point */ CmLList *node /* node to be added */ ) -#else -Void cmLListInsCrnt(lCp, node) -CmLListCp *lCp; /* list control point */ -CmLList *node; /* node to be added */ -#endif { #ifdef ERRCHK if (!lCp) - RETVOID; + return; #endif lCp->count++; @@ -215,7 +192,7 @@ CmLList *node; /* node to be added */ { lCp->crnt = lCp->first = lCp->last = node; node->next = NULLP; - RETVOID; + return; } node->next = lCp->crnt; @@ -228,7 +205,7 @@ CmLList *node; /* node to be added */ lCp->first = node; lCp->crnt = node; - RETVOID; + return; } /* end of cmLListInsCrnt */ /* cm_llist_c_001.main_7 - Add function */ @@ -245,22 +222,16 @@ CmLList *node; /* node to be added */ * File: cm_llist.c * */ -#ifdef ANSI Void cmLListInsAfterCrnt ( CmLListCp *lCp, /* list control point */ CmLList *node /* node to be added */ ) -#else -Void cmLListInsAfterCrnt(lCp, node) -CmLListCp *lCp; /* list control point */ -CmLList *node; /* node to be added */ -#endif { #ifdef ERRCHK if (!lCp) - RETVOID; + return; #endif lCp->count++; @@ -268,7 +239,7 @@ CmLList *node; /* node to be added */ if (lCp->count == 1) { lCp->crnt = lCp->first = lCp->last = node; - RETVOID; + return; } node->prev = lCp->crnt; @@ -281,7 +252,7 @@ CmLList *node; /* node to be added */ lCp->last = node; lCp->crnt = node; - RETVOID; + return; } /* end of cmLListInsAfterCrnt */ @@ -301,17 +272,11 @@ CmLList *node; /* node to be added */ * File: cm_llist.c * */ -#ifdef ANSI CmLList *cmLListDelFrm ( CmLListCp *lCp, /* list control pointer */ CmLList *node /* node to be removed */ ) -#else -CmLList *cmLListDelFrm(lCp, node) -CmLListCp *lCp; /* list control pointer */ -CmLList *node; /* node to be removed */ -#endif { #ifdef ERRCHK @@ -370,23 +335,17 @@ CmLList *node; /* node to be removed */ * File: cm_llist.c * --*/ -#ifdef ANSI Void cmLListCatLList ( - CmLListCp *list1, /*-- list control point --*/ - CmLListCp *list2 /*-- node to be added --*/ - ) -#else -Void cmLListCatLList(list1, list2) - CmLListCp *list1; /*-- list control point --*/ - CmLListCp *list2; /*-- node to be added --*/ -#endif +CmLListCp *list1, /*-- list control point --*/ +CmLListCp *list2 /*-- node to be added --*/ +) { /*-- if the second list is empty nothing to do --*/ if(list2->count == 0) { - RETVOID; + return; } /*-- if the first list is empty make first the same as second*/ @@ -408,9 +367,35 @@ Void cmLListCatLList(list1, list2) cmLListInit(list2); - RETVOID; + return; } /*-- end of cmLListCatLList --*/ + +/*-- + * + * Fun: cmLListDeleteLList + * + * Desc: delete a linked list + * + * Ret: None + * + * Notes: None + * + * File: cm_llist.c + * + --*/ +Void cmLListDeleteLList +( +CmLListCp *list /*-- list control point --*/ +) +{ + while(list->count) + { + cmLListDelFrm(list, list->first); + } + return; +} + /********************************************************************** End of file **********************************************************************/