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 "core/fxcrt/include/fx_memory.h" | 7 #include "core/fxcrt/fx_memory.h" |
8 #include "core/fxcrt/plex.h" | 8 #include "core/fxcrt/plex.h" |
9 | 9 |
10 CFX_Plex* CFX_Plex::Create(CFX_Plex*& pHead, | 10 CFX_Plex* CFX_Plex::Create(CFX_Plex*& pHead, |
11 uint32_t nMax, | 11 uint32_t nMax, |
12 uint32_t cbElement) { | 12 uint32_t cbElement) { |
13 CFX_Plex* p = | 13 CFX_Plex* p = |
14 (CFX_Plex*)FX_Alloc(uint8_t, sizeof(CFX_Plex) + nMax * cbElement); | 14 (CFX_Plex*)FX_Alloc(uint8_t, sizeof(CFX_Plex) + nMax * cbElement); |
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() { | 19 void CFX_Plex::FreeDataChain() { |
20 CFX_Plex* p = this; | 20 CFX_Plex* p = this; |
21 while (p) { | 21 while (p) { |
22 CFX_Plex* old = p; | 22 CFX_Plex* old = p; |
23 p = p->pNext; | 23 p = p->pNext; |
24 FX_Free(old); | 24 FX_Free(old); |
25 } | 25 } |
26 } | 26 } |
OLD | NEW |