diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/unimodem/new/mic/ilist.cpp | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/unimodem/new/mic/ilist.cpp')
-rw-r--r-- | private/unimodem/new/mic/ilist.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/private/unimodem/new/mic/ilist.cpp b/private/unimodem/new/mic/ilist.cpp new file mode 100644 index 000000000..64350a621 --- /dev/null +++ b/private/unimodem/new/mic/ilist.cpp @@ -0,0 +1,58 @@ +// +// Copyright (c) 1996 Microsoft Corporation +// +// +// ILIST.CPP -- Implementation for Classes: +// CInfList +// +// +// History: +// 05/27/96 JosephJ Created +// +// +#include "common.h" + +/////////////////////////////////////////////////////////////////////////// +// CLASS CInfList +/////////////////////////////////////////////////////////////////////////// + +// Simple singly-linked list which can not be modified once it's been +// created. Assumes creation and eventual deletion are protected by some +// external critical section. +// +// Sample: +// for (; pList; pList = pList->Next()) +// { +// const CInfAddregSection *pAS = (CInfAddregSection *) pList->GetData(); +// } + +//-------------- FreeList ------------------ +// Distroys the list. +void +CInfList::FreeList (CInfList *pList) +{ + while(pList) + { + // Cast to get rid of the const declaration of pList->Next(). + CInfList *pNext = (CInfList *) pList->Next(); + delete pList; + pList = pNext; + } +} + +//-------------- ReverseList ------------------ +// Reverses the specified list. +void +CInfList::ReverseList (const CInfList **ppList) +{ + CInfList *pList = (CInfList *) *ppList; // override const + const CInfList *pPrev = NULL; + while(pList) + { + const CInfList *pTmp = pList->Next(); + pList->mfn_SetNext(pPrev); + pPrev = pList; + pList = (CInfList *) pTmp; // override const + } + *ppList = pPrev; +} |