1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "../../include/fxcrt/fx_basic.h"
8 #include "plex.h"
Create(CFX_Plex * & pHead,FX_DWORD nMax,FX_DWORD cbElement)9 CFX_Plex* CFX_Plex::Create(CFX_Plex*& pHead, FX_DWORD nMax, FX_DWORD cbElement)
10 {
11     CFX_Plex* p = (CFX_Plex*)FX_Alloc(FX_BYTE, sizeof(CFX_Plex) + nMax * cbElement);
12     p->pNext = pHead;
13     pHead = p;
14     return p;
15 }
FreeDataChain()16 void CFX_Plex::FreeDataChain()
17 {
18     CFX_Plex* p = this;
19     while (p != NULL) {
20         FX_BYTE* bytes = (FX_BYTE*)p;
21         CFX_Plex* pNext = p->pNext;
22         FX_Free(bytes);
23         p = pNext;
24     }
25 }
26