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